#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
// Dynamic Memory Allocation
//--------------------------------------------------------------------------
class student
{
private:
int rno ;
char name [25] ;
public:
student ()
{
rno = 0 ;
strcmp ( name , "N.A" ) ;
}
void getinfo ()
{
gotoxy ( 10 , 5 ) ;
cout << "Enter Roll No .................... : " ;
cin >> rno ;
gotoxy ( 10 , 7 ) ;
cout << "Enter Name ....................... : " ;
gets ( name ) ;
}
void showinfo ( int row )
{
gotoxy ( 5 , row ) ;
cout << rno ;
gotoxy ( 25 , row ) ;
cout << name ;
}
};
//#define max 500
//-----------------------------------------------------------------------
void main ()
{
clrscr () ;
student *ptr ;
char ch = 0 ;
int counter = 0 ;
while ( ch !='n' && ch !='N' )
{
clrscr () ;
gotoxy ( 10 , 3 ) ;
cout << "Record No : " << ( counter + 1 ) ;
ptr = new student ;
ptr -> getinfo () ;
counter ++ ;
ptr=ptr+1;
gotoxy ( 10 , 23 ) ; cout << "Do you want to enter [Y/N] : " ;
ch = getch () ;
}
clrscr () ;
for ( int i = 0 ; i < counter ; i++ )
{
ptr -> showinfo ( 5 + i ) ;
ptr =ptr-1 ;
}
getch () ;
}
"I have not failed. I've just found 10,000 ways that won't work."
--Thomas Edison
"Not everything that can be counted counts, and not everything that counts can be counted."
--Albert Einstein
"If you can't make it good, at least make it look good."
"Your most unhappy customers are your greatest source of learning."
--Bill Gates
No comments:
Post a Comment