fork download
  1. int main()
  2. {
  3. int a[] = {1,2,3,4,5,6,7,8,9};
  4. int sz = 9;
  5. int cnt = 0;
  6. for(int i = 1; i < sz; ++i)
  7. {
  8. for(int j = i; j > 0; --j)
  9. {
  10. cnt+=1;
  11. if (a[j] < a[j - i])
  12. swap(a[j], a[j - 1]);
  13. }
  14. }
  15. printf("%d", cnt);
  16. return 0;
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:12:36: error: ‘swap’ was not declared in this scope
                 swap(a[j], a[j - 1]);
                                    ^
prog.cpp:15:21: error: ‘printf’ was not declared in this scope
     printf("%d", cnt);
                     ^
stdout
Standard output is empty