cout << "Please enter account number and service code <s or p>" << endl;
int accountNum;
char serviceCode;
int dayMinutes, nightMinutes;
cin >> accountNum >> serviceCode;
while (serviceCode != 's' && serviceCode != 'S' && serviceCode != 'p' && serviceCode != 'P') {
cout << "Please enter account number and VALID service code <s or p>" << endl;
cin >> accountNum >> serviceCode;
}
cout << serviceCode;
int regMinutes;
if (serviceCode == 's' || 'S') {
cout << "Please enter number of minutes" << endl;
cin >> regMinutes;
while (regMinutes < 0) {
cout << "Please enter VALID number of minutes" << endl;
cin >> regMinutes;
}
}
elseif (serviceCode == 'p' || 'P') {
cout << "Please enter number of daytime minutes and nighttime minutes." << endl;
cin >> dayMinutes >> nightMinutes;
while (dayMinutes + nightMinutes < 0) {
cout << "Please enter VALID number of daytime minutes and nightime minutes." << endl;
cin >> dayMinutes >> nightMinutes;
}
So I am having a little trouble figuring this out. If I input the service code as 's' the program works perfectly and it does the math correctly later on. If I input the service code as 'p', then print the service code to show it knows the service code is 'p', it still says the first if statement is true that service code == 's' or 'S'. Is it a syntax error? I've been working on this since yesterday and I am stuck.
Huh, I was not expecting it to be so simple. Thank you for your help I need to remember to add that in there everytime and not think of it as if this equals to this or this, and think of it as if this equals to this or this equals to this.