My SENTINEL value of "-99" operates just fine, however when I enter in numbers, using a space in between, and finally press the "ENTER" key, nothing happens. What I am trying to accomplish is:
a) store 'x' amount of numbers a user enters
b) determine the smallest number of those 'x' amount of numbers
c) output the smallest number to the user's display device
...the rest of my program runs smoothly and as such, I've left out code for the non-relevant area; ease of reading.
#include <iostream>
#include <iomanip>
usingnamespace std;
constint menuChoiceB_SENTINEL = -99; // Terminates 'while' loop under Menu Choice 'b'//
// Start of Main program //
int main()
{ // Start of Main //
int smallNum, smallestNum;
int nextSmallNum = ' ';
elseif (menuChoice == 'b')
{ // start "menu" if //
system ("CLS");
cout << "Menu Choice 'b'\n"
<< "Please enter any amount of numbers, using a space between each number.\n"
<< "Entering ''-99'' (without quotes) will return you to the 'Main Menu'.\n" << endl;
cin >> smallNum;
smallestNum = smallNum;
while (nextSmallNum != menuChoiceB_SENTINEL)
{ // start while //
cin >> nextSmallNum;
} // endwhile //
if (smallestNum > nextSmallNum && nextSmallNum != menuChoiceB_SENTINEL)
{ // start if //
smallestNum = nextSmallNum;
cout << "The smallest number entered was: " <<endl;
cout << smallestNum << endl;
} // end if //
} // end "menu" if //