#include <iostream>
usingnamespace std;
int main() {
bool first = true;
while (first) {
cout << "Enter a number (X to exit): ";
int num;
cin >> num;
if(first){
min = value;
first = false;
} elseif (value < min){
min = value;
}cout << "Minimum value: " << min << endl;
}
returnfalse;
}
I know its jacked up any comments in the code would be great I need to finish the program but also understand it. Thanks.
Thanks yeah I just keep getting myself more confused but the prompt is too ask the user to input number(s) and then to return the minimum value of those numbers which can be positive or negative. The specifics of the program are use any loop and boolean variable types.
- Then i suggest you set up either a switch statement or if else statements and use a menu instead of having the user enter "x" to quit.
- After that, just use the loops and do what you need to do.
- Moreover, using boolean variables in this example seems somewhat pointless unless your professor is building up to something that i'm not seeing.
- Additionally, i don't see you returning 0 in your code, and i would advise you to make a menu and make a do while loop so that the user can do what he/she wants to until he/she wants to quit.