Untitled
unknown
c_cpp
a year ago
938 B
1
Indexable
Never
// Example program #include <iostream> #include <string> using namespace std; struct Student { int id; string name; float gpa; }; void InputStudent(Student & student) { int id; string name; float gpa; cout << "enter id student: "; cin >> id; cout << "enter name student: "; cin >> name; cout << "enter GPA student: "; cin >> gpa; student.id = id; student.name = name; student.gpa = gpa; } void OutputStudent(Student student) { cout << "Id student: " << student.id << endl; cout << "Name student: " << student.name << endl; cout << "GPA student: " << student.gpa << endl; } int main() { int n; cout << "enter the number student: "; cin >> n; Student * students = new Student[n]; for (int i = 0; i < n; i++) { InputStudent(students[i]); } for (int i = 0; i < n; i++) { OutputStudent(students[i]); } return 0; }