: In function ‘int main()’:
:38: error: expected primary-expression before ‘else’
:38: error: expected `;' before ‘else’
:47: error: expected primary-expression before ‘else’
:47: error: expected `;' before ‘else’
CODE
include <iostream>
using namespace std;
double Dep1= 250000;// Declare Variables
double Dep2= 25000;
double Dep3= 10000;
double Inter1= 3.20;
double Inter2= 3.16;
double Inter3= 2.76;
double cash = 0;
int main()
{
cout << "Deposit: "; // Enter Pounds as a Single Integer
cin >> cash; //Read the Amount of Pounds
{ if ( cash > 50000);
double cashIn = cash / 100 * 3.20;
double IntPaid = cashIn;
cout << "Rate = " << 3.20 << endl;
cout << "Interest = " << IntPaid << endl;
}
{
else if (cash < 50000);
double cashIn = cash / 100 * 3.16;
double IntPaid = cashIn;
cout << "Rate =" << 3.16 << endl;
cout << "Interest = "<< IntPaid << endl;
}
{
else if (cash <= 10000);
double cashIn = cash / 100 * 2.76;
double IntPaid = cashIn;
cout << "Rate =" << 2.76 << endl;
cout << "Interest =" << IntPaid << endl;
}
}
Hi could you tell me what is wrong with this code at all please as i keep getting the error message posted above-it is a programe that is meant to 'ask for a deposit sum and print out the interest rate and the total interest gained from the deposit. Three different interest rates are used and each one will calculate the rate dependent on the amount of cash deposit ie: Dep1 calculates the rate for sums between 50.000-250.000 etc. Any feedback will be greatly appreciated as this is an assignment thats due in this week. Thankyou very much. Tara200
This post has been edited by Tara200: 29 Oct, 2007 - 01:13 PM