![]() |
|
#1
|
|||
|
|||
Switch Statement ProblemProblems with switch statement
a program that will allow the user to input two fractions and one of the four operations of +, - , *, and / . Once this information has been entered, the program should compute the operation on the two fractions and then output the answer appropriate labeled. Reducing the fractions using the gcd algorithm. The program should then ask the user if another number is desired (y or n) and continue requesting pairs of fractions until the user answers no (n). My problem is encorporating the switch statement for the operations and also the gcd algorithm. Here is what I have, I only used addition and sub. because I couldn't figure out how to use the switch. -------------------------------------------------------------------------------------------------- CPP / C++ / C Code:
Last edited by JdS : 14-Oct-2004 at 08:43.
Reason: Please insert your example C/C++ codes between [c] and [/c] tags
|
|||
|
#2
|
||||
|
||||
|
Hi dontcare.
I don't see that you have any problems with the switch statement whatsoever (beyond your indentation ). It appears that the program just needs to be completed.CPP / C++ / C Code:
That looks right to me. As for the other part of the question, it looks suspiciously like a homework assignment. I don't speak for everyone, but I don't get any credit for doing other peoples homework. I don't have any problem helping if you have more specific problems or questions.Good luck! __________________
The best damn Sports Blog period. |
|
#3
|
|||
|
|||
|
Your right for know I will omit the gcd algo. but could explain to me how you call functions I would appreciate it. Thanks
|
|
#4
|
||||
|
||||
|
Quote:
CPP / C++ / C Code:
Also, note the indentation. Check the tutorials section for the Formatting Code tutorial __________________
The 3 Laws of the Procrastination Society: 1) Never do today that which can be put off until tomorrow 2) Tomorrow never comes |
Recent GIDBlog
Not selected for officer school by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: Command Line Arguments, Part 1 | WaltP | C Programming Language | 0 | 10-Jul-2004 23:34 |
| Another FX 5600 problem (but with details that might shed light on this) | BobDaDuck | Computer Hardware Forum | 2 | 16-Apr-2004 07:53 |
| Help a C++ Idiot: I am trying to fill an array based on a switch statement. | Psycop | C Programming Language | 2 | 14-Apr-2004 03:12 |
| switch statement | freedomJoe | C Programming Language | 0 | 27-Oct-2003 08:45 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The