-
errors
hey guys can some body help me with this program coz when compile it theirs to many errors or can apply printf statement to it
Code:
#include<iostream>
#iinclude<iomanip.h>
#include<math.h>
int main ()
{
double amount,
principal=1000.0,
rate=0.5
cout<<"year"<<setw(21)
<<"Amount on deposit""<<end1;
for(int year<=10;year++){
amount=principal*pow(1.0+rate'year);
cout<<setw(4)<<year
<<setiosflags(ios::fixed/ios:showpoint)
<<setw(21)<<setprecission(2)
<<amount<<end1;
}
return 0;
}
-
1) You need a semi-colon at the end of your double declaration.
2) Most of the cin/cout stuff is in std. use std::cout (for example), or do a using namespace std; outside & before your main() function.
3) for() has three parts: for(initial_statement; test_condition; after_each_loop) -- you're missing the middle one.
-
start by adding a ; after the rate = 0.5
see what happens.
-
hey thanks mate i've found what was missing on the for loop .the middle part which is'year<=10'.
-
looks like i have miss out many things in this program now i have to run it again.thanks for your help .