i can't run my program bcoz of this error..

#include<iostream>
#include<math.h>
#include<string.h>
#include<iomanip>
{
int main()

int x,y,z,r;
float a; 
char ch;
cout<<" enter amount";
cin>>x; 
cout<<" enter number of years to be paid";
cin>>y; 
cout<<" enter the rate"<<endl;
cin>>z; 
r= z/100;
cout<<" what would you like to compute?"<<endl;
cout<<" A = simple interest"<<endl;
cout<< " B = comppound interest"<<endl;
cin>>ch;
ch = toupper(ch);
if ( ch=='A')
{
a= x * ( 1 + ( r*y));
cout<<" simple interest amount = %f"<<a<<endl;
}
if (ch== 'B')
{
cout<<" what would be the rate?";
cout<<" 1 = annually"; 
cout<<" 2 = sime annual"; 
cout<<" 3 = quarterl"; 
cout<<" 4 = monthly"; 
cin>>b;
e= r/b;
f=y*b;
g= (1+ (e*y));
h=pow(g,f);
a=x*h;
cout<<"compound amount with the interest = %f"<<a<<endl;
}
return 0;
}

Recommended Answers

All 2 Replies

Append the statement using namespace std; after the inclusion of the headers and you should be fine. This is because the C++ implementation wraps all the standard functions in a namespace std, so you have to make the compiler aware of that by using the "using namespace std;" statement.

Also if you are using new style of header inclusion, stick to it and don't mix the two techniques.

Also you positioning of braces is incorrect -- you have got them all skewed, you need to use the opening braces for writing function definations and not before them.

Do something like:

#include <iostream>
#include <cmath>
#include <cstring>
#include <iomanip>
using namespace std ;

int main( void )
{
   // code
}

What's this?

#include<iomanip>
{
int main()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.