fork download
  1. #include<iostream.h>
  2. #include<iomanip.h>
  3. int main(void)
  4. { char s1;
  5. int i,s[100][4],n,j,s2,s3,s4;
  6. float a[100];char ch[100];
  7.  
  8. { cout<<"班級人數?";
  9. cin>>n;
  10. }
  11.  
  12. for (i=0;i<n;i++)
  13. { cout<<"輸入三成績\n";
  14. cin>>s[i][0]>>s[i][1]>>s[i][2];
  15. }
  16.  
  17. for (i=0;i<n;i++)
  18. {
  19. s[i][3]=s[i][0]+s[i][1]+s[i][2];
  20. a[i]=s[i][3]/3.0;
  21.  
  22. if (a[i]>=60)
  23. ch[i]='P';
  24. else
  25. ch[i]='F';
  26. }
  27. cout<<" 國文 英文 數學 加總 平均 "<<endl<<"==============================\n";
  28.  
  29. for (i=0;i<n;i++)
  30. cout<<setw(5)<<s[i][0]<<setw(5)<<s[i][1]<<setw(5)<<s[i][2]<<setw(5)<<s[i][3]
  31. <<setw(8)<<setprecision(2)<<a[i]<<" "<<ch[i]<<endl<<endl;
  32.  
  33. cout<<"==========================================\n";
  34. {
  35. s2=0,s3=0,s4=0
  36. for (i=0;i<n;i++)
  37. {s2=s2+s[i][0]
  38. s3=s3+s[i][1]
  39. s4=s4+s[i][2]
  40.  
  41. s2=s2/n
  42. s3=s3/n
  43. s4=s4/n }
  44. cin>>s1;
  45. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:21: error: iostream.h: No such file or directory
prog.cpp:2:20: error: iomanip.h: No such file or directory
prog.cpp: In function ‘int main()’:
prog.cpp:8: error: ‘cout’ was not declared in this scope
prog.cpp:9: error: ‘cin’ was not declared in this scope
prog.cpp:13: error: ‘cout’ was not declared in this scope
prog.cpp:14: error: ‘cin’ was not declared in this scope
prog.cpp:27: error: ‘cout’ was not declared in this scope
prog.cpp:27: error: ‘endl’ was not declared in this scope
prog.cpp:30: error: ‘setw’ was not declared in this scope
prog.cpp:31: error: ‘setprecision’ was not declared in this scope
prog.cpp:36: error: expected `;' before ‘for’
prog.cpp:36: warning: statement has no effect
prog.cpp:36: error: expected `;' before ‘)’ token
prog.cpp:44: error: ‘cin’ was not declared in this scope
prog.cpp:5: warning: unused variable ‘j’
prog.cpp:45: error: expected `}' at end of input
stdout
Standard output is empty