#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
using namespace std;
int main()
{
double accNum;
string scode;
string scodeab;
double minu;
double minam;
double minpm;
cout << fixed << setprecision(2);
cout << "Please enter account number: " << endl;
cin >> accNum;
cout << "Please enter service code: P(for premium) or R(for regular)" << endl;
cin >> scode;
if (scode == "r"||"R")
{cout << "Pleas enter minutes used" << endl;
cin >> minu;
if (minu > 50)
{minu = ((minu - 50) * .20) + 10;
cout << "Your Total Balance is: $" << minu << endl;}
else
{cout << "Your total balance is: $10.00" << endl;}
}
else if (scode == "p" || "P")
{cout << "Pleas enter type A or B: " << endl;
cin >> scodeab;
bmanzana
0
Newbie Poster
Recommended Answers
Jump to PostMaybe if you tried
if ((scode == "r") || (scode == "R"))
Jump to PostI think its because you have ORed "R", which is a non-zero value and thus the statement always evaluates to true.
The same problem with your second if statement. And why you using string when you need to store just a character?
Jump to PostStudy operator precedence. I know it's boring as hell, think of it as the same kind of thing as learning your times tables -> boring as hell but great to know once you know. It helps a lot to be able to look at an expression and know what order …
All 10 Replies
gerard4143
371
Nearly a Posting Maven
vidit_X
29
Junior Poster
bmanzana
0
Newbie Poster
doug65536
18
Light Poster
bmanzana
0
Newbie Poster
doug65536
18
Light Poster
bmanzana
0
Newbie Poster
doug65536
18
Light Poster
bmanzana
0
Newbie Poster
doug65536
18
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.