c ++ console application

//--------------------------------------------------------------------------- #include <vcl.h> #include <iostream.h> #include <conio.h> #pragma hdrstop //--------------------------------------------------------------------------- #pragma argsused int main(int argc, char* argv[]); using std::cout; using std::endl; int suma(int); {for(int x=1; x<=10; x++) cout<<suma(x)<<" "; return 0; } int suma(int y); {return y+y;} //--------------------------------------------------------------------------- 

It produces the following error:

 [C++ Error] Unit1.cpp(20): E2040 Declaration terminated incorrectly 

help me please

    2 answers 2

    remove the semicolon in line 20 ( int suma(int y); )

      The main function has a body, but no header. It is necessary so:

       int main(int argc, char* argv[]) //Обрати внимание на отсутствие точки с запятой { for(int x=1; x<=10; x++) cout<<suma(x)<<" "; return 0; } 

      And as you wrote earlier, remove ";" in the last but one line.