Code:// student_data_read_practice.cpp // program which reads data of some students #include <iostream> #include <cstdlib> #include <string> #include <cstring> using namespace std; /* Move all this to a header file, using std:: as needed.*/ ///////////////////////////////////////////////////// struct Date {int d; string m; int y;}; //use longer variable names //////////////////////////////////////////////////// ///////////////////////////////////////////////////// struct Student {int rollno; string sex; string name; float gpa; Date DOB;}; //don't use all caps for variable names //Make this into a class with print and read methods ///////////////////////////////////////////////////// Student read(); void prnt(Student dummystud); /*end of area to move*/ int main() { Student stud[5];//Don't mix tabs and spaces for indination. for(int i=0; i<5; i++) { cout << "enter student #" << (i+1) << "'s details below:-" << endl; stud[i] = read(); prnt(stud[i]); cout << endl << endl; } system("pause"); return 0; } //----------------------------------------------- // Student read() definition Student read()//I would make this a constructor for Student instead. { Student stud; string name; cout << "enter name: "; getline(cin, name); cout << "enter roll number: "; cin >> stud.rollno; cout << "enter sex: "; cin >> stud.sex; cout << "enter date of birth (e.g. 01 Jan 2000) below:-" << endl; cout << "enter day: "; cin >> stud.DOB.d; cout << "enter month: "; cin >> stud.DOB.m; cout << "enter year: "; cin >> stud.DOB.y; cout << "enter GPA: "; cin >> stud.gpa; cin.ignore(); return stud; } //------------------------------------------------- // void prnt() definition void prnt (const Student &dummystud) { cout << "\n\n\n************************************\n\n\n"; cout << "roll no.: " << dummystud.rollno << endl; cout << "name: " << dummystud.name << endl; cout << "sex: " << dummystud.sex << endl; cout << "date of birth: " << dummystud.DOB.d << "-" << dummystud.DOB.m << "-" << dummystud.DOB.y << endl; if (dummystud.gpa >= 3.5) cout << "grade: A" << endl; else if (dummystud.gpa >= 3.0) cout << "grade: B" << endl; else if (dummystud.gpa >= 2.0) cout << "grade: C" << endl; else cout << "Pass" << endl; cout << "\n\n\n************************************"; } //----------------------------------------------------