fork download
  1. void main(void) //All C++ projects need a main function
  2. {
  3. function1();
  4. }
  5.  
  6. void function1() //A function that doesn't return anything when called
  7. {
  8. cout<<"Hello!\n";
  9. cout<<function2();
  10. }
  11.  
  12. int function2() //Returns an int when called
  13. {
  14. return 2;
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:15: error: ‘::main’ must return ‘int’
 void main(void) //All C++ projects need a main function
               ^
prog.cpp: In function ‘int main()’:
prog.cpp:3:11: error: ‘function1’ was not declared in this scope
 function1();
           ^
prog.cpp: In function ‘void function1()’:
prog.cpp:8:1: error: ‘cout’ was not declared in this scope
 cout<<"Hello!\n";
 ^
prog.cpp:9:17: error: ‘function2’ was not declared in this scope
 cout<<function2();
                 ^
stdout
Standard output is empty