Advertisement
KristianIvanov00

EightTask

Feb 24th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. const int MAX = 63;
  4. const int Students = 5;
  5. struct Student
  6. {
  7. char name[MAX];
  8. int FN;
  9. };
  10.  
  11.  
  12. void readStudent(Student arr[], int size)
  13. {
  14. for (int i = 0; i < size; i++)
  15. {
  16. std::cout << "Enter student name: ";
  17. std::cin.getline(arr[i].name, MAX);
  18. std::cout << "Enter student faculty number: ";
  19. std::cin >> arr[i].FN;
  20. std::cin.ignore();
  21. }
  22. }
  23.  
  24. void printStudent(Student arr[], int size)
  25. {
  26. for (int i = 0; i < size; i++)
  27. {
  28. std::cout << std::endl;
  29. std::cout << "Name: " << arr[i].name << std::endl;
  30. std::cout << "FN: " << arr[i].FN;
  31. std::cout << std::endl;
  32. }
  33. }
  34. int main()
  35. {
  36. Student arr[Students];
  37. readStudent(arr, Students);
  38. printStudent(arr, Students);
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement