It's supposed to calculate the amount that the user input.
I keep getting this error everytime:
error: expected :primary-expression before '<=' token
for the lines below in bold:
This is my code fragment:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#include <iostream>
#include <iomanip>
using namespace std;
int
main()
{
double loanAmt = 0;
double depositAmt = 0;
a
//Prompt for input
cout << "\nEnter the loan amount: $";
cin >> loanAmt;
//Calculations
if (loanAmt >= 10000 && <= 24999)
depositAmt = depositAmt + (loanAmt*(5/100));
else if (loanamt >= 25000 && <= 39999)
depositAmt = depositAmt + (loanAmt*(10/100));
else if (loanamt >= 40000 && <= 55000)
depositAmt = depositAmt + (loanAmt*(15/100));
else
cout << "\nInvalid loan amount!" << endl;
cout << "The required deposit is: $" << depositAmt << endl;
return 0;
}
|
Note: I still need to set the final answer to 2 decimal places, but I think I can handle that bit
Last edited on
Hi,
The expression is incomplete, you probably meant:
if (loanAmt >= 10000 && loanAmt <= 24999)
The relational operators >= are binary, they need 2 operands.
Good Luck !!
By the way, please don't start a new topic on the same subject, just keep the old one going.
Last edited on