Thread: Problem 1

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    1

    Problem 1

    display a menu
    1 for program on strings
    2 for program on pythagorean triples
    enter your choice:
    if the user enters 1 your program should execute the strings program
    if the user enters 2 your program should do the pythagorean triples.
    program accepts two strings from the user and comapres them
    If the strings match, your program prints "Match"
    else if there is a common prefix (beginning characters), your program
    prints those characters
    else if there is a common suffix (ending characters), your program prints
    those characters
    else if there are any matching characters, your program prints those matching
    characters.

    Please follow the sample run of the program carefully, Your program should produce
    the SAME output for the input used in this sample run.

    Sample run:


    enter string 1 <ctrl d to quit> stagger

    enter string 2 <ctrl d to quit> dagger

    the two strings have mathinc characters: ager

    enter string 1 <ctrl d to quit> worcester

    enter string 2 <ctrl d to quit> leicester

    the two strings have a matching suffix: cester

    enter string 1 <ctrl d to quit> worcester

    enter string 2 <ctrl d to quit> worcmastet

    the two strings have a common prefix: worc

    enter string 1 <ctrl d to quit> mystring

    enter string 2 <ctrl d to quit> yourballoon

    the two strings have maching character:

    enter string 1 <ctrl d to quit> ^d

    normal termination!


    Note: the ctrl d exit option is optional. You will not lose any points if you
    did not incorporate that.


    Part II
    program accepts a non-negative integer from the user and prints all
    possible pythagorean triples, where each number in the triple is less than
    or equal to the non-negative number given by the user.

    here's the sample run:


    enter bound: <ctrl d to quit>
    (5,4,3)
    total no of triples upto 5 is: 1

    enter bound: <ctrl d to quit>
    (5,4,3)
    (10,8,6)
    total no of triples upto 12 is: 2

    enter bound: <ctrl d to quit>
    (5,4,3)
    (10,8,6)
    (13,12,5)
    (15,12,9)
    (17,15,8)
    (20,16,12)
    (25,20,15)
    (25,24,7)
    (26,24,10)
    (29,21,20)
    (30,24,18)
    (34,30,16)
    (35,28,21)
    (37,35,12)
    (39,36,15)
    (40,32,24)
    (41,40,9)
    total no of triples upto 44 is: 17

    enter bound: <ctrl d to quit>
    (5,4,3)
    (10,8,6)
    (13,12,5)
    (15,12,9)
    (17,15,8)
    (20,16,12)
    (25,20,15)
    (25,24,7)
    (26,24,10)
    (29,21,20)
    (30,24,18)
    (34,30,16)
    (35,28,21)
    (37,35,12)
    (39,36,15)
    (40,32,24)
    (41,40,9)
    (45,36,27)
    (50,40,30)
    (50,48,14)
    (51,45,24)
    (52,48,20)
    (53,45,28)
    (55,44,33)
    total no of triples upto 56 is: 24

    enter bound: <ctrl d to quit>
    normal termination!

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    115
    and???????????
    there are only 10 people in the world, those who know binary and those who dont

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    All I see is an assignment. Do you have a question? And if you do, make sure it's not "Please write this program for me"!
    Make an attempt, then post your problem if you get stuck!
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  4. #4
    Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Posts
    2,595

    Homework

    I'm am posting this because it appears that you are posting a homework assignment or other project and you are asking for someone else to do all of the work.

    Please don't ask people to do all your work for you, See the announcement on Homework at the top of the forum to see what is acceptable or PM me.

    Basically people are happy to help, but they're not going to do it all for you.

    Show us what you've got, show your code (using code tags), or where you're confused and someone will be happy to help you I'm sure. If it's something that you absolutely don't understand how it works, like you have no clue how qsort works, then ask a general question about the function and I'm sure someone will explain it. Though they may not give you all of the code for it, but someone will explain the concept.

    On obivous homework questions especially, I also like to remind people of the board's tenth guildeline, while this board is very helpful to people, make sure you have your instructor's permission before seeking help on assignments. While people on these boards are more than happy to help, we discourage people from asking for help on graded work without the instructor's permission, and we claim no repsonsibilty for any cheating or honor violations.

    Feel free to PM me with any questions.

    Good Luck,

    Kermi3
    Lead Moderator
    Kermi3

    If you're new to the boards, welcome and reading this will help you get started.
    Information on code tags may be found here

    - Sandlot is the highest form of sport.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM