Advertisement
Guest User

pastebintitle

a guest
Jan 28th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cstring>
  4. using namespace std;
  5. ifstream fin("clasa.txt");
  6. struct bara{
  7. char nume[20],prenume[20];
  8. int zi,luna,an;
  9. }elev[30];
  10.  
  11. int main()
  12. {
  13. int nr,caun=1,caup=1, j=0;
  14. cin>>nr;
  15. cin.get();
  16. cout<<"+----------------------+---------------+";
  17. char s[110];
  18. for (int i=0;i<nr;i++)
  19. {
  20. j=0;
  21. fin.getline(s,110);
  22. while(s[j]!= ' ')
  23. {
  24. elev[caun].nume[j] = s[j];
  25. j++;
  26. }
  27. caun++;
  28. j++;
  29. while(s[j]!= '/')
  30. {
  31. elev[caun].prenume[j] = s[j];
  32. j++;
  33. }
  34. }
  35. cout<<elev[1].nume;
  36.  
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement