1 Replies - 256 Views - Last Post: 20 February 2011 - 05:28 PM Rate Topic: -----

#1 Guest_collegejunkie*


Reputation:

Programming Ass. with a loop and a switch statement

Posted 20 February 2011 - 05:03 PM

here is the assignment. What I'm wondering is how to construct the switch statement. I've got the while loop fixed to figure out the calculations, but I'm not sure on how or what the switch statement is supposed to do??

For this assignment, your program should ask the user for three calculations to perform,
one at a time. See the sample output below for a clearer picture. Your program should
print out the results of each of the calculations.
Required structures to use: when handling menu choices, you must use a switch
statement. For dealing with each of the prompts, you must use a loop. You may not use
any predefined libraries/functions to help you with your calculations.

Sample output:
Enter your first number: 28
Enter your second number: 27
1. Find the sum.
2. Find the product.
3. Find the difference.
4. Find the quotient.
5. Find the modulus.
6. Find the smaller number.
7. Find the larger number.
8. Find the first number raised to the second number.
9. Find the second number raised to the first number.
Your choice: 1
Result: 55
1. Find

Is This A Good Question/Topic? 0

Replies To: Programming Ass. with a loop and a switch statement

#2 jimblumberg  Icon User is offline

  • member icon


Reputation: 3846
  • View blog
  • Posts: 11,775
  • Joined: 25-December 09

Re: Programming Ass. with a loop and a switch statement

Posted 20 February 2011 - 05:28 PM

You may want to start with this link: Control structures, it should help explain switch statements.


Jim
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1