fork(1) download
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. #define INT_FIVE int i = 5;
  5. #define DOUBLE_FIVE double d = 5;
  6.  
  7. int main() {
  8.  
  9. cout << "The normal square root of 5 is: " << sqrt(DOUBLE_FIVE) << endl;
  10. cout << "The int square root of 5 is: " << (int)sqrt(INT_FIVE) << endl;
  11. return 0;
  12. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:9:4: error: ‘cout’ was not declared in this scope
    cout << "The normal square root of 5 is: " << sqrt(DOUBLE_FIVE) << endl;
    ^
prog.cpp:9:4: note: suggested alternative:
In file included from prog.cpp:1:0:
/usr/include/c++/4.8/iostream:61:18: note:   ‘std::cout’
   extern ostream cout;  /// Linked to standard output
                  ^
prog.cpp:5:21: error: expected primary-expression before ‘double’
 #define DOUBLE_FIVE double d = 5;
                     ^
prog.cpp:9:55: note: in expansion of macro ‘DOUBLE_FIVE’
    cout << "The normal square root of 5 is: " << sqrt(DOUBLE_FIVE) << endl;
                                                       ^
prog.cpp:9:66: error: expected primary-expression before ‘)’ token
    cout << "The normal square root of 5 is: " << sqrt(DOUBLE_FIVE) << endl;
                                                                  ^
prog.cpp:9:66: error: expected ‘;’ before ‘)’ token
prog.cpp:4:18: error: expected primary-expression before ‘int’
 #define INT_FIVE int i = 5;
                  ^
prog.cpp:10:57: note: in expansion of macro ‘INT_FIVE’
    cout << "The int square root of 5 is: " << (int)sqrt(INT_FIVE) << endl;
                                                         ^
prog.cpp:10:65: error: expected primary-expression before ‘)’ token
    cout << "The int square root of 5 is: " << (int)sqrt(INT_FIVE) << endl;
                                                                 ^
prog.cpp:10:65: error: expected ‘;’ before ‘)’ token
stdout
Standard output is empty