fork(4) download
  1. #include <iostream>
  2. 2 using namespace std;
  3. 3 int a=5;
  4. 4 int b=2;
  5. 5 void add()
  6. 6 {
  7. 7 int sum;
  8. 8 sum = a + b;
  9. 9 cout <<"Sum of a and b is "<<sum<<"\n";
  10. 10 }
  11. 11 int main()
  12. 12 {
  13. 13 add;
  14. 14 return 0;
  15. 15 }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:1: error: expected unqualified-id before numeric constant
 2    using namespace std;
 ^
prog.cpp:3:1: error: expected unqualified-id before numeric constant
 3    int a=5;
 ^
prog.cpp:4:1: error: expected unqualified-id before numeric constant
 4    int b=2;
 ^
prog.cpp:5:1: error: expected unqualified-id before numeric constant
 5    void add()
 ^
prog.cpp:11:1: error: expected unqualified-id before numeric constant
 11  int main()
 ^
stdout
Standard output is empty