error ISO C++ forbids declaration of `Main' with no type

hello, I wrote this program but I can't find the mistske.
Can you help me please? the instruction are the following :
input: 2 positive numbers (x,y)
output: the total of the numbers include in the space between (x,y)

I wrote this code :


#include <iostream>
#include <cstdlib>
#include <math.h>
#include <conio.h>
#include <stdlib.h>
using namespace std;


int inputdata(int &a, int &b);
int add ( int k, int b, int &s);

Main()
{
int x,y,somma;
inputdata(x,y);
total=0;
add(x,y,total);
cout<<"the total of the numbers include in the space between (x,y)"<<total<<endl;


system("PAUSE");
return EXIT_SUCCESS;
}

int inputdata(int &a, int &b)
{
cout<<"write the first number"<<endl;
cin>>a;
cout<<"write the second number"<<endl;
cin>>b;
}

int add ( int k, int b, int &s)
{
int i;
for (i=k;i<b;i++)
{
s=s+1;
}
}



the error is this:
error ISO C++ forbids declaration of `Main' with no type


Thank you for helping :)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include <cstdlib>
#include <math.h>
#include <conio.h>
#include <stdlib.h> 
using namespace std;


int inputdata(int &a, int &b);
int add ( int k, int b, int &s);

int main()
{
int x,y,total;
inputdata(x,y);
total=0;
add(x,y,total);
cout<<"the total of the numbers include in the space between (x,y)"<<total<<endl;


system("PAUSE");
return EXIT_SUCCESS;
}

int inputdata(int &a, int &b)
{
cout<<"write the first number"<<endl;
cin>>a;
cout<<"write the second number"<<endl;
cin>>b;
}

int add ( int k, int b, int &s)
{
int i;
for (i=k;i<b;i++) 
{
s=s+1;
}
} 
if I write int main there is the following error:
[Linker error] undefined reference to `WinMain@16'
ld returned 1 exit status

what does it mean?
Choose "console application" from IDE settings when create a new project, not "win32 GUI application".
thank you, I solved it
Topic archived. No new replies allowed.