I have an if stmt which checks to see if a char value (upper or Lower) is equal to a value input by end user. My understanding was if you are using a char value in a conditional stmt you need to put single quotes around the char value. If that is correct than I could use some help figuring out why my if/else stmt is not working. It is ignoring the if stmt I think. Thanks for any help.
{
//Variable declaration
int AccountNumber;
char ServiceType;
int RegServiceMinutes = 0;
int PremDayMinutes = 0;
int PremNightMinutes = 0;
double rAmount;
double pAmount;
// double AmountDue;
cout << fixed << showpoint;
cout << setprecision(2);
cout << "This program calculates and prints a cellular phone bill" << endl;
cout << endl;
cout << "Enter account number: " ;
cin >> AccountNumber;
cout << endl;
cout << "Enter Service type: "
<< "R or r (Regular Service) "
<< "P or p (Premium Service) ";
cin >> ServiceType;
// cout << endl;
if (ServiceType == 'r' || 'R')
{
cout << "Enter number of minutes used for Regular Service: ";
cin >> RegServiceMinutes;
}
else
{
cout << "Enter number of day minutes used for Premium Service: ";
cin >> PremDayMinutes;
cout << endl;
cout << "Enter number of night minutes used for Premium Service: ";
cin >> PremNightMinutes;
cout << endl;