Anyone please help me to correct the "declaration syntax error."

#include<stdio.h>
voidmain
{
int u;
float b=100.00;
cout<<"/n Enter units(u)";
cin>>u;
if(u>0&&u<=100)
b=b+u*1;

if(u>100&&u<=200)
b=b+100*1+(u-100)*2;

if(u>200&&u<=300)
b=b+100*1+100*2+(u-200)*3;

if(u>300)
b=b+100*1+100*2+100*3+(u-300)*5;

else
cout<<"/n wrong data entered";
cout"/n bill="<<b;
}
//close main....
The first few lines:

1
2
3
#include<stdio.h>
voidmain
{


should look something like this:
1
2
3
4
5
6
#include <iostream>

using namespace std;

int main()
{


It should always be int main() (two words). Some compilers may accept void, but that is non-standard and should be avoided.
Topic archived. No new replies allowed.