Classwork 3 - UMBC-CMSC104/General GitHub Wiki
We'll be practicing using variables and conditionals in today's classwork.
I want you to make a simple program with a menu, similar to this:
Welcome to classwork 3!
Please select one of the following options:
1) Add two numbers
2) Multiply two numbers
Your selection:
The user will select 1 or 2. If the user selects 1, prompt the user for two numbers to add together. Here's some example output:
You have selected "add two numbers."
Please enter the first number: 8
Please enter the second number: 3
8 + 3 = 11
If the user selects 2, prompt the user for two numbers to multiply together. Here's some example output:
You have selected "multiply two numbers."
Please enter the first number: 10
Please enter the second number: 2
10 * 2 = 20
If the user selects any other number for the menu, display an error:
Invalid menu selection!
Notes
-
Look through the powerpoint slides for reference. Use the course material from the slides and from the example code
-
Remember not to use the assignment operator if you're trying to test for equivalence
-
To display quotes using printf, you must escape the " character. You can do this by typing backslash. So:
printf("This string is "quoted."\n");
-
Use https://github.com/UMBC-CMSC104/General/blob/master/live-demos/variables.c as a baseline!