cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
expression must have bool type (or be co
expression must have bool type (or be convertible to bool)
Sep 9, 2016 at 6:30pm UTC
joekamel12
(8)
I have been thru the other forums on this issue, but cannot find a solution to this issue. If anyone can provide some assistance, I would appreciate it. This error is showing for the "stateCode" int the "if" statement. See the following:
double salesTaxCalc(double totalSalesAmt, string stateCode)
{
double salesTaxAmt;
double totalSalesAmt;
string stateCode;
char KS;
if (stateCode = KS)
salesTaxAmt = totalSalesAmt * KS_SALES_TAX_RATE;
else
salesTaxAmt = totalSalesAmt * MO_SALES_TAX_RATE;
return salesTaxAmt;
}
Sep 9, 2016 at 6:47pm UTC
shadowmouse
(539)
You've put a single equals sign instead of double equals.
Sep 9, 2016 at 6:58pm UTC
cire
(8284)
You've put a single equals sign instead of double equals.
Although equality wouldn't make sense either, since KS is an uninitialized char variable.
Perhaps you meant:
if
(stateCode ==
"KS"
) ...
Last edited on
Sep 9, 2016 at 6:59pm UTC
Sep 14, 2016 at 5:17am UTC
joekamel12
(8)
Thanks!!
Topic archived. No new replies allowed.