Please Help Me With My C++ Program

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

  1. beanie_man

    beanie_man Member

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

    (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. peerk

    peerk New Member

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

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

    samm Next in Line

    Joined:
    Dec 22, 2000
    Messages:
    2,630
    Likes Received:
    0
    Location:
    San Jose, CA
    post your code and we can help
     

Share This Page