Having some issues with this program needs to use a loop an bool variables
Output should look like this
Enter a number (X to Exit): -11
Enter a number (X to Exit): x
Minimum value: -11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include<iostream>
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;
}
#include <iostream>
int main()
{
bool first = true;
int min;
while ( true )
{
std::cout << "Enter a number (X to exit): ";
int number;
if ( !( std::cin >> number ) ) break;
if ( first )
{
min = number;
first = !first;
}
elseif ( number < min )
{
min = number;
}
}
if ( !first ) std::cout << "The minimum = " << min << std::endl;
else std::cout << "You did not enter any number" << std::endl;
return 0;
}