Advertisement
anhlocpr

Untitled

May 8th, 2017
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int n;
  5. float dtb;
  6. class sinhvien
  7. {
  8. private:
  9. char hoten[20];
  10. int namsinh;
  11. float toan,ly,hoa,anh,van,sinh,su,dia,tin;
  12. public:
  13. void nhap();
  14. void xuat();
  15. float tinh();
  16. void xet(int *t);
  17. };
  18.  
  19. void sinhvien::nhap()
  20. {
  21. cout<<"nhap ho ten sinh vien: ";
  22. cin.ignore();
  23. cin.get(hoten,20);
  24. cout<<"nhap nam sinh: ";
  25. cin>>namsinh;
  26. cout<<"nhap diem toan: ";
  27. cin>>toan;
  28. cout<<"nhap diem ly: ";
  29. cin>>ly;
  30. cout<<"nhap diem hoa: ";
  31. cin>>hoa;
  32. cout<<"nhap diem anh: ";
  33. cin>>anh;
  34. cout<<"nhap diem van: ";
  35. cin>>van;
  36. cout<<"nhap diem sinh: ";
  37. cin>>sinh;
  38. cout<<"nhap diem su: ";
  39. cin>>su;
  40. cout<<"nhap diem dia: ";
  41. cin>>dia;
  42. cout<<"nhap diem tin: ";
  43. cin>>tin;
  44. }
  45.  
  46. void sinhvien::xuat()
  47. {
  48. cout<<"Ho ten sinh vien: "<<hoten<<endl;
  49. cout<<"Nam sinh: "<<namsinh<<endl;
  50. cout<<"Diem toan: "<<toan<<endl;
  51. cout<<"Diem ly: "<<ly<<endl;
  52. cout<<"Diem hoa: "<<hoa<<endl;
  53. cout<<"Diem anh: "<<anh<<endl;
  54. cout<<"Diem van: "<<van<<endl;
  55. cout<<"Diem sinh: "<<sinh<<endl;
  56. cout<<"Diem su: "<<su<<endl;
  57. cout<<"Diem dia: "<<dia<<endl;
  58. cout<<"Diem tin: "<<tin<<endl;
  59. }
  60.  
  61. float sinhvien::tinh()
  62. {
  63. //float dtb;
  64. dtb=(toan+ly+hoa+anh+van+sinh+su+dia+tin)/9;
  65. return dtb;
  66. }
  67.  
  68. void sinhvien::xet(int * thilai)
  69. {
  70. // int dem;
  71. if(dtb>7&&toan>=5&&ly>=5&&hoa>=5&&anh>=5&&van>=5&&sinh>=5&&su>=5&&dia>=5&&tin>=5)
  72. // dem++;
  73. // cout<<dem;
  74. cout<<"LAM KHOA LUAN TOT NGHIEP!"<<endl;
  75. if(dtb<7&&dtb>5&&toan>=5&&ly>=5&&hoa>=5&&anh>=5&&van>=5&&sinh>=5&&su>=5&&dia>=5&&tin>=5)
  76. cout<<"THI TOT NGHIEP !"<<endl;
  77. if(dtb<5){
  78. *thilai +=1;
  79. cout<<"THI LAI!"<<endl;
  80. }
  81. }
  82.  
  83. int main()
  84. {
  85. int i,dem;
  86. int thilai;
  87. thilai = 0;
  88. cout<<"nhap so luong sinh vien: ";
  89. cin>>n;
  90. sinhvien sv[100];
  91. for(i=0;i<n;i++)
  92. {
  93. cout<<"nhap thong tin sinh vien thu "<<i+1<<endl;
  94. sv[i].nhap();
  95. }
  96. cout<<"THONG TIN SINH VIEN: "<<endl;
  97. for(i=0;i<n;i++)
  98. {
  99. cout<<"thong tin sinh vien thu "<<i+1<<endl;
  100. sv[i].xuat();
  101. cout<<"diem trung binh cua sinh vien: "<<sv[i].tinh()<<endl;
  102. sv[i].xet(&thilai);
  103. }
  104. cout<<"so sv thi lai: "<<thilai;
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement