uncertainty

You don't need a default constructor as std::string has its own.

Note that stream extraction (>>) stops when a white-space char is found. So you can't enter say a location of New York. Only New will be obtained and York will be the input for the next extraction.

Where you are expecting a numeric input with extraction and an invalid number is entered then the input stream enters fail state and no further extraction can take place until the fail state is cleared - and probably the invalid input also cleared from the stream.

 
while (number < 0 || number > 5)


What are options 0, 4 and 5?

Usually when doing multiple tests an an integer, the switch statement is used. Something like as a skeleton outline:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
switch (number) {
    case 1:
        // Case 1 code here
    break;

    case 2:
        // Case 2 code here
    break;

    // Other valid cases here

    default:
        cout << "cout << "Invalid Option! Enter a Valid Option: " << endl;
        break;
} 


variables userInput and arrays aren't used.
Last edited on
Please don't delete/erase original question. Subsequent answers are pretty meaningless without knowing to what they refer!
Topic archived. No new replies allowed.