fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. size_t Counter();
  6. size_t CounterValue();
  7. void ResetCounter();
  8.  
  9. int main()
  10. {
  11. vector<int> myvec = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  12.  
  13. for (int e : myvec)
  14. if (e % 2) Counter();
  15. cout << CounterValue() << endl;
  16. ResetCounter();
  17.  
  18. for (int e : myvec)
  19. if (e % 3) Counter();
  20. cout << CounterValue() << endl;
  21. ResetCounter();
  22.  
  23. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:11:2: error: ‘vector’ was not declared in this scope
  vector<int> myvec = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  ^
prog.cpp:11:9: error: expected primary-expression before ‘int’
  vector<int> myvec = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
         ^
prog.cpp:11:9: error: expected ‘;’ before ‘int’
prog.cpp:13:15: error: ‘myvec’ was not declared in this scope
  for (int e : myvec)
               ^
prog.cpp:18:15: error: ‘myvec’ was not declared in this scope
  for (int e : myvec)
               ^
stdout
Standard output is empty