fork(2) download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. double x1, y1, x2, y2;
  6.  
  7. int main()
  8. {
  9. cout << "Input x1, y1: ";
  10. cin >> x1, y1;
  11. cout << "Input x2, y2: ";
  12. cin >> x2, y2;
  13.  
  14. cout << "Distance between points: " << sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
  15.  
  16. return 0;
  17. }
  18.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:5:12: error: ‘double y1’ redeclared as different kind of symbol
 double x1, y1, x2, y2;
            ^
In file included from /usr/include/features.h:371:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426,
                 from /usr/include/c++/4.8/iostream:38,
                 from prog.cpp:1:
/usr/include/i386-linux-gnu/bits/mathcalls.h:242:1: error: previous declaration of ‘double y1(double)’
 __MATHCALL (y1,, (_Mdouble_));
 ^
prog.cpp: In function ‘int main()’:
prog.cpp:10:18: warning: right operand of comma operator is a reference, not call, to function ‘y1’ [-Waddress]
     cin >> x1, y1;
                  ^
prog.cpp:10:18: warning: right operand of comma operator has no effect [-Wunused-value]
prog.cpp:12:18: warning: right operand of comma operator has no effect [-Wunused-value]
     cin >> x2, y2;
                  ^
prog.cpp:14:76: error: invalid operands of types ‘double’ and ‘double(double)throw ()’ to binary ‘operator-’
     cout << "Distance between points: " << sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
                                                                            ^
stdout
Standard output is empty