By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,227 Members | 1,290 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,227 IT Pros & Developers. It's quick & easy.

problem with very simple C++ program

P: 12
Hi everyone!

I am trying to make a c++ program that calculates interest rates. So far, i have written this code, but my complier (dev c++) keeps error-ing. Can anyone please help?


Expand|Select|Wrap|Line Numbers
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main ()
  6. {
  7. float intRate;
  8. float principal;
  9. float time;
  10. float interest
  11. cout << "Enter the interest rate: ";
  12. cin >> intRate;
  13. cout << "How much money are you investing? $";
  14. cin >> principal;
  15. cout << "How long are you investing? ";
  16. cin >> time;
  17. interest = (intRate / 100) * principal * time;
  18. cout << "The total interest you have made is: $" << interest << endl;
  19. cout << "The total balance is: $" << interest + principal << endl;
  20. system("PAUSE");
  21. return 0;
  22. }
PS look at the bolded code - i think the problem lies there...


Thanks again
Mar 18 '07 #1
Share this Question
Share on Google+
2 Replies


DeMan
100+
P: 1,806
What is the error you are getting from DEV? And why do you think the problem lies in that line?

There is a missing semicolon after you declare interest.
Mar 18 '07 #2

100+
P: 1,646
Hi. You have missed a semi-colon of the end of this declaration
Expand|Select|Wrap|Line Numbers
  1. float interest;
The code works in vc++ after this change
Mar 18 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.