fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. struct sinhvien
  7. {
  8. string tensv;
  9. string masinhvien;
  10. float diemtb;
  11.  
  12. };
  13.  
  14. int main(){
  15.  
  16. sinhvien sv;
  17. int n;
  18. cout << "nhap vao so luong sinh vien : ";
  19. cin >> n;
  20. fflush(stdin);
  21. for (int i = 0; i < n; i++){
  22. cout << "nhap vao thong tin sinh vien thu " << i + 1 << " : " << endl;
  23. cout << "nhap vao ten sinh vien : ";
  24. getline(cin, sv.tensv);
  25. cout << "nhap vao ma sinh vien: ";
  26. getline(cin, sv.masinhvien);
  27. cout << "nhap vao diem : ";
  28. cin >> sv.diemtb;
  29. cout << endl << endl << endl;
  30. fflush(stdin);
  31.  
  32.  
  33. }
  34.  
  35. for (int i = 0; i < n; i++)
  36. {
  37. cout << "sinh vien thu " << i + 1 << " : " << endl;
  38. cout << "ten :" << sv.tensv << endl;
  39. cout << "ma sinh vien : " << sv.masinhvien << endl;
  40. cout << "dien trung binh mon : " << sv.diemtb << endl;
  41. fflush(stdin);
  42. system("pause");
  43. }
  44.  
  45.  
  46. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:20:9: error: use of undeclared identifier 'stdin'
        fflush(stdin);
               ^
prog.cpp:30:10: error: use of undeclared identifier 'stdin'
                fflush(stdin);
                       ^
prog.cpp:41:10: error: use of undeclared identifier 'stdin'
                fflush(stdin);
                       ^
prog.cpp:42:3: error: use of undeclared identifier 'system'
                system("pause");
                ^
4 errors generated.
stdout
Standard output is empty