fork download
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5.  
  6. double avg (double x, y);
  7.  
  8. int main() {
  9. double x;
  10. double y;
  11. cin >> x;
  12. cin >> y;
  13. cout << "Average is " << avg(x, y);
  14. }
  15.  
  16. return 0;
  17. }
  18. double avg (double x, double y) {
  19. double z=(x+y)/2;
  20. return z;
  21. }
  22.  
  23.  
Compilation error #stdin compilation error #stdout 5s 3296KB
stdin
6
2
compilation info
prog.cpp:6:23: error: ‘y’ has not been declared
 double avg (double x, y);
                       ^
prog.cpp:16:1: error: expected unqualified-id before ‘return’
 return 0;
 ^
prog.cpp:17:1: error: expected declaration before ‘}’ token
 }
 ^
stdout
Standard output is empty