fork download
  1. #include <vector>
  2. using namespace std;
  3.  
  4. struct predmet
  5. {
  6. double c;
  7. double v;
  8. predmet()
  9. {
  10. c=1;
  11. }
  12. };
  13.  
  14. vector<predmet> Predmets;
  15. int num;
  16.  
  17. double reflesh(int num)
  18. {
  19. double S=0;
  20. for (int i = 0; i < num; i++)
  21. {
  22. S+=Predmets[i].c*Predmets[i].v;
  23. }
  24. return(S/num);
  25. }
  26.  
  27. int main() {
  28. double coef=244 / 136;
  29. int semestr;
  30. cout<<"number of predmets";
  31. cin>>num;
  32. Predmets.resize(num);
  33. cout<<"semestr:prioretet(0-10)";
  34. for (int i = 0; i < num; i++)
  35. {
  36. cin>>semestr;
  37. if(semestr<10)
  38. if(semestr==1)
  39. Predmets[i].c+=coef-1;
  40. else if(semestr<100)
  41. if(semestr/10 == 1 || semestr % 10 == 1)
  42. Predmets[i].c+=coef;
  43. else if(semestr<1000)
  44. if(semestr/100 == 1 || semestr/10 == 1 || semestr % 10 == 1)
  45. Predmets[i].c+=coef+1;
  46. cin>>Predmets[i].v;
  47.  
  48. }
  49. cout<<"you number ";
  50. printf( "%.3f\n", reflesh(num) );
  51. cout<<" correct number ";
  52. printf( "%.3f\n", 6.32352941176);
  53. system("pause");
  54. return 0;
  55. }
Compilation error #stdin compilation error #stdout 0s 3416KB
stdin
2
1 10
2 1
compilation info
prog.cpp: In function 'int main()':
prog.cpp:30:2: error: 'cout' was not declared in this scope
  cout<<"number of predmets";
  ^
prog.cpp:31:2: error: 'cin' was not declared in this scope
  cin>>num;
  ^
prog.cpp:50:33: error: 'printf' was not declared in this scope
  printf( "%.3f\n", reflesh(num) );
                                 ^
prog.cpp:53:16: error: 'system' was not declared in this scope
  system("pause");
                ^
stdout
Standard output is empty