// Program to display Student's data using array of pointers to class. // Assignment-22 // arrptstd.cpp, Author - Krishna Kumar Khatri. // Uncomment ONLY the following line if you are using Turbo/Borland compiler. // #define TC #ifdef TC #include #else #include using namespace std; #endif #include // For getch. const int MAXLEN = 25; class Student { int rollno; char name[MAXLEN]; public: void getdata(); void putdata(); }; void Student::getdata() { cout << "Enter Roll no: "; cin >> rollno; cout << "Corresponding Name: "; cin.getline(name, MAXLEN, '~'); } void Student::putdata() { cout << name << ", " <> n; } while (n < 1 || n > MAXLEN); cout << "\nNow enter student deails,\n"; /* Set aside memory for students */ for (i = 0; i < n; i++) { pobj[i] = new Student; pobj[i]->getdata(); } cout << "\nData read,"; for (i = 0; i < n; i++) pobj[i]->putdata(); cout << endl << endl << "Program over. Press any key to exit..."; getch(); return 0; // Successful termination. }