I am just learning how to program and need help, I have no clue what to do. Everything I have tried has been a miserable failure. Help is appreciated thanks!
My teacher asked us to do this: The Problem:
Write a program that will allow the user to input a minimum and maximum integer. Then, the program should ask the user if they would like to count or sum the integers. If the user chooses to count the numbers, the program should list all of the integers from the minimum to the maximum. If the user chooses to sum, the program should sum all the integers from the minimum to the maximum.
Test Data:
The user inputs 1 as the minimum number and 5 as the maximum. They choose to count. The program outputs 1 2 3 4 5.
The user inputs 1 as the minimum number and 5 as the maximum. They choose to add. The program outputs 15.
//1 + 2 + 3 + 4 + 5 = 15
Algorithm:
1. Get the min value ------------ cin
2. Get the max value
3. Get the choice
Take the action according to the choice (You can use either switch or if statement here)
I don't know how to do that. I was hoping someone could show me a code that works and explain the steps
You don't know how to ask the user if they would like to count or sum the integers, but you do know how to ask for and store a min and max value?
I think now would be an excellent time to review your book or instructional material and actually make an attempt at coding a solution, rather than attempting to get others to do it for you.