I cannot for the life of me figure out how to end the loop if the customer enters 'E' or 'e'. I have to use a string for the userCustomerCode, so how do i check for a character?? HELP!!!
I think that is better to check if that string variable has got the 'E' character after it is read. In that way, you will not execute the whole loop until the while-condition sees the stop-flag.
I think you can do that much easier, just by making an equality check: if(useCustomerCode !="E". I did't check that, to see if it's correct, but I'm just saying.
A string consists of characters and can be accessed like an array (with the [ ] parentheses) or with the string member function at().
For example if you want to get the first character of a string, you write userCustomerCode[0]; // 0 because the first element is always 0 . Or userCustomerCode.at(0);
The difference between the access operator [] and the member function at() is that if you try to read an element which doesn't exist (is out of boundaries), the member function will throw an exception (error) while the operator won't.
@CosminNTG - I tried that, but every time I entered an E or e to test my code, the program quit with an unexpected error...I tried with "E" and 'E' and "e" and 'e'.