fork download
  1. #include<bits/stdc++.h>
  2.  
  3. #define endl '\n'
  4. #define FOI(i, a, b) for(int i = (a); i < (b); i++)
  5. #define FOD(i, a, b) for(int i = (a); i > (b); i--)
  6. #define FOIE(i, a, b) for(int i = (a); i <= (b); i++)
  7. #define FODE(i, a, b) for(int i = (a); i >= (b); i--)
  8.  
  9. typedef long long ll;
  10.  
  11. using namespace std;
  12.  
  13. struct NhanVien
  14. {
  15. string code;
  16. string name;
  17. string gender;
  18. string birthday;
  19. string district;
  20. string taxcode;
  21. string date;
  22. };
  23.  
  24. void nhap(NhanVien &a)
  25. {
  26. cin.ignore();
  27. getline(cin, a.name);
  28. getline(cin, a.gender);
  29. getline(cin, a.birthday);
  30. getline(cin, a.district);
  31. getline(cin, a.taxcode);
  32. getline(cin, a.date);
  33. }
  34.  
  35. void chuanhoa(string &code, int n)
  36. {
  37. string s = to_string(n + 1);
  38. while(s.size() < 5)
  39. {
  40. s = "0" + s;
  41. }
  42. code = s;
  43. }
  44.  
  45.  
  46. void inds(NhanVien a[], int n)
  47. {
  48. FOI(i, 0, n)
  49. {
  50. chuanhoa(a[i].code, i);
  51. cout << a[i].code << " " << a[i].name << " " << a[i].gender << " " << a[i].birthday << " " << a[i].district << " " << a[i].taxcode << " " << a[i].date << endl;
  52. }
  53. }
  54.  
  55. int main(){
  56. struct NhanVien ds[50];
  57. int N,i;
  58. cin >> N;
  59. for(i = 0; i < N; i++) nhap(ds[i]);
  60. inds(ds,N);
  61. return 0;
  62. }
Success #stdin #stdout 0.01s 5304KB
stdin
Standard input is empty
stdout
Standard output is empty