Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- const int MAX = 63;
- const int Students = 5;
- struct Student
- {
- char name[MAX];
- int FN;
- };
- void readStudent(Student arr[], int size)
- {
- for (int i = 0; i < size; i++)
- {
- std::cout << "Enter student name: ";
- std::cin.getline(arr[i].name, MAX);
- std::cout << "Enter student faculty number: ";
- std::cin >> arr[i].FN;
- std::cin.ignore();
- }
- }
- void printStudent(Student arr[], int size)
- {
- for (int i = 0; i < size; i++)
- {
- std::cout << std::endl;
- std::cout << "Name: " << arr[i].name << std::endl;
- std::cout << "FN: " << arr[i].FN;
- std::cout << std::endl;
- }
- }
- int main()
- {
- Student arr[Students];
- readStudent(arr, Students);
- printStudent(arr, Students);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement