Discussion in 'OT Technology' started by beanie_man, Nov 2, 2005.

1. ### beanie_manMember

Joined:
Aug 9, 2004
Messages:
77
0
Can some please help me with these 2 problems in c++. Thanks a ton

(Pythagorean riples) A right triangle can have sides that are all integers. A set of three integer values for the sides of a right triangle is called a Pythagorean triple. These three sides must satisfy the relationship that the sum of the squares of two of the sides is equal to the square of the hypotenuse. Find all Pythagorean triples for side1, side2, and hypotenuse all no larger than 500. Use a triple-nested for loop that tries all possibilities. This is an example of brute force computing. You will learn in more advanced computer -science courses that there are many interesting problems for which there is no known algorithmic approach other than sheer brute force.
--------------------------------------------------------------------------

("The Twelve Days of Christmas" Song) Write a program that uses repetition and switch statments to print the song "The Twelve Days of Christmas." One switch statement should be used to print the day (i.e. "First," "Second," etc.). A seperate switch statement should be used to print the remainder of each verse. Vist the web site www.12days.com/library/carols/12daysofxmas.htm for the complete lyrics to the song.

2. ### peerkNew Member

Joined:
Mar 14, 2005
Messages:
984
0
Do you have any code to post?

The first one is just 3 nested loops and a cout in an if statement.

Joined:
Dec 22, 2000
Messages:
2,630