fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define quick() ios_base::sync_with_stdio(false); cin.tie(0);
  4. #define pb push_back
  5. #define ll long long
  6. int mod=1000000007;
  7.  
  8. struct SinhVien{
  9. string msv,ten,lop,ns;
  10. float gpa;
  11. };
  12.  
  13. void nhap(SinhVien a[],int n){
  14. for(int i=0;i<n;i++){
  15. cin.ignore();
  16. getline(cin,a[i].ten);
  17. cin>>a[i].lop>>a[i].ns>>a[i].gpa;
  18. a[i].msv="B20DCCN"+string(3-to_string(i+1).size(),'0')+to_string(i+1);
  19. if(a[i].ns[1]=='/'){
  20. a[i].ns="0"+a[i].ns;
  21. }else if(a[i].ns[4]=='/'){
  22. a[i].ns.insert(3,"0");
  23. }
  24. }
  25. }
  26. void in(SinhVien a[],int n){
  27. for(int i=0;i<n;i++){
  28. cout<<a[i].msv<<' '<<a[i].ten<<' '<<a[i].lop<<' '<<a[i].ns<<' '<<
  29. fixed<<setprecision(2)<<a[i].gpa<<endl;
  30. }
  31. }
  32. int main(){
  33. struct SinhVien ds[50];
  34. int N;
  35. cin >> N;
  36. nhap(ds, N);
  37. in(ds, N);
  38. return 0;
  39. }
Success #stdin #stdout 0.01s 5556KB
stdin
1

Nguyen Van An

D20CQCN01-B

2/12/2002

3.19
stdout
B20DCCN001  Nguyen Van 0.00