Question
I have to create a c++ program. I really don't know where to begin. Can someone please point me in the right direction to do this:
I have to create a c+ + program. I really don't know where to begin. Can someone please point me in the right direction to do this: The Pythagorean Theorem states that the sum of the squares of the legs of a right triangle is equal to the square of the hypotenuse. Any three numbers fitting the Pythagorean Theorem are referred to as a Pythagorean triple. Use nested for loops to generate and display every possible combination of integer sides less than 100 and display those combinations that are in fact Pythagorean triples. Do not display any unique combination more than once. Use another set of nested for loops to determine all of the prime numbers between 1 and 1000. A number is prime if it is divisible only by itself and 1. Display the prime numbers to the screen and store them in the file primes.txt one number per line. Use another set of nested for loops to display the letters "R" and "B" in patterns as they might appear on a checkerboard.
Explanation / Answer
#include #include #include //pyth.cpp //a^2+b^2=c^2 -- The Pythagorean Theorem //This C++ program takes information inputted about a triangle, and using the Pythagorean Theorem: //Either solves for a, b, or c, and displays properties about a simulated triangle with those variables //For example, we would find and output the area, perimeter, etc. of that triangle //I would say to credit this if you used it in your schoolwork, but you probably won't anyway //I do accept payment, donations, and gifts of appreciation in the form of money and women //(c)2012 Ty K. using namespace std; string AskIfGoAgain(){ int loop = 1; string answer = "y"; while (loop == 1){ answer = "y"; cout > answer; if (answer == "y"){return answer;} else if (answer == "n"){return answer;} else { cout b; //Prompts user to input b cout > c; //Promts user to input c bSquared = b*b; cSquared = c*c; //Finds each variable's square.. if that makes grammatical/syntactical sense a = cSquared - bSquared; //Finds a cout