anhkiet2507

Fix ho

Sep 21st, 2021
600
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4. class SinhVien{
  5. private:
  6.     string MaSV, HoTen,Lop,NgaySinh;
  7.     float GPA;
  8. public:
  9.     SinhVien();
  10.     friend void nhap(SinhVien &a);
  11.     friend void in(SinhVien &a);
  12. };
  13. SinhVien::SinhVien(){
  14.     MaSV = HoTen = Lop = NgaySinh = "";
  15.     GPA = 0;
  16. }
  17. void nhap(SinhVien &a){
  18.     a.MaSV = "B20DCCN001";
  19.     cin.ignore();
  20.     getline(cin, a.HoTen);
  21.     cin >> a.Lop;
  22.     cin >> a.NgaySinh;
  23.     cin >> a.GPA;
  24. }
  25. void in(SinhVien &a){
  26.     cout << a.MaSV << " " <<  a.Lop << " " << a.HoTen << " " << a.NgaySinh << " " << a.GPA << endl;
  27. }
  28. int main(){
  29.     SinhVien a();
  30.     nhap(a);
  31.     in(a);
  32.     return 0;
  33. }
  34.  
RAW Paste Data