fork download
  1. //很蠢且沒觀念的改法
  2. int main(int argc, char* argv[]){
  3. int n;
  4. int a,b,c,d,e;
  5. for(int i=0;i<2;i++){ //外層迴圈
  6. //cout<<"the #1:";
  7. //cin>>a;
  8. argv[1];
  9. //cout<<"the #2:";
  10. //cin>>b;
  11. argv[2];
  12. //cout<<"the #3:";
  13. //cin>>c;
  14. argv[3];
  15. }
  16. //n=a+b+c;//將n丟到function A
  17. n=argv[1]+argv[2]+argv[3];
  18.  
  19. function_A(n,.....);
  20.  
  21. //cout<<"the #4:";
  22. //cin>>d;
  23. argv[4];
  24. //cout<<"the #5:";
  25. //cin>>e;
  26. argv[5];
  27. //d和e 丟到function B
  28.  
  29. for(int j=0;j<2;j++){ //內層迴圈
  30. function_B(&argv[4],&argv[5],....);
  31. }
  32. }
  33.  
  34. //batch檔的寫法
  35. //test 5 5 5 1 1
  36. //pause
  37.  
  38. //失敗!
  39.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main(int, char**)’:
prog.cpp:8: warning: statement has no effect
prog.cpp:11: warning: statement has no effect
prog.cpp:14: warning: statement has no effect
prog.cpp:17: error: invalid operands of types ‘char*’ and ‘char*’ to binary ‘operator+’
prog.cpp:19: error: expected primary-expression before ‘...’ token
prog.cpp:19: error: ‘function_A’ was not declared in this scope
prog.cpp:23: warning: statement has no effect
prog.cpp:26: warning: statement has no effect
prog.cpp:30: error: expected primary-expression before ‘...’ token
prog.cpp:30: error: ‘function_B’ was not declared in this scope
prog.cpp:4: warning: unused variable ‘a’
prog.cpp:4: warning: unused variable ‘b’
prog.cpp:4: warning: unused variable ‘c’
prog.cpp:4: warning: unused variable ‘d’
prog.cpp:4: warning: unused variable ‘e’
stdout
Standard output is empty