fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int glob = 0; // Kαθολική (public)
  6.  
  7.  
  8. int F(int x){
  9.  
  10. int num = 0; // Τοπική (local)
  11. glob += 10;
  12. num = glob + x;
  13. glob = val; // ΣΦΑΛΜΑ
  14.  
  15. return num;
  16. }
  17.  
  18.  
  19. int main(){
  20.  
  21. int val = 0; // Τοπική (local)
  22. cin >> val;
  23. cout << num << endl; // ΣΦΑΛΜΑ
  24. cout << x << endl; // ΣΦΑΛΜΑ
  25. cout << glob << endl; // OK
  26. cout << F(val) << endl;
  27.  
  28. return 0;
  29. }
  30.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
13
compilation info
prog.cpp: In function ‘int F(int)’:
prog.cpp:13:10: error: ‘val’ was not declared in this scope
   glob = val; // ΣΦΑΛΜΑ
          ^~~
prog.cpp: In function ‘int main()’:
prog.cpp:23:11: error: ‘num’ was not declared in this scope
   cout << num << endl;   // ΣΦΑΛΜΑ
           ^~~
prog.cpp:24:11: error: ‘x’ was not declared in this scope
   cout << x << endl;  // ΣΦΑΛΜΑ
           ^
stdout
Standard output is empty