fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. typedef struct
  5. {
  6. char MaNV[5];
  7. char TenNV[30];
  8. char ChucVu[20];
  9. int SoNam;
  10. float HeSo;
  11. }NHANVIEN;
  12. void nhapthongtin(NHANVIEN a[], int &n)
  13. {
  14.  
  15.  
  16. for (int i=0; i<n;i++)
  17. {
  18. cin.ignore();
  19.  
  20. cout<<"Nhap vao MSNV"<<endl;
  21. cin.getline(a[i].MaNV,5);
  22. cout<<"Nhap vao Ten Nhan Vien"<<endl;
  23. cin.getline(a[i].TenNV,30);
  24. cout<<"Nhap vao chuc vu"<<endl;
  25. cin.getline(a[i].ChucVu,20);
  26. cout<<"Nhap vao so nam lam viec"<<endl;
  27. cin>>a[i].SoNam;
  28. cout<<"Nhap vao he so luong"<<endl;
  29. cin>>a[i].HeSo;
  30. }
  31. }
  32. int main()
  33. {
  34. NHANVIEN a[100];
  35. int n;
  36. cout<<"Nhap vao so nhan vien "<<endl;
  37. cin>>n;
  38. nhapthongtin(a,n);
  39.  
  40. string s;
  41. s="Pham Ngoc Cuong";
  42. cout<<s.length();
  43.  
  44.  
  45. }
Success #stdin #stdout 0s 2824KB
stdin
1
K39.103.009
Pham Ngoc Cuong
Boss
3
7
stdout
Nhap vao so nhan vien 
Nhap vao MSNV
Nhap vao Ten Nhan Vien
Nhap vao chuc vu
Nhap vao so nam lam viec
Nhap vao he so luong
15