C++ Program Using getdata() and display()





The program uses member function getdata() and display() in-order to input student’s entry and display’s it at the end. This program contains class named ‘student’. The member function getdata() is used to take input and display() is used in-order to produce output.

#include<iostream.h>

#include<conio.h>

Class student

{

Private:

Char stname[25], stgender[10];

Int stage;

Public:

Void getdata ()

{

Cout<<”\n enter the name”;

Cin>>stname;

Cout<<”\n enter the gender”

Cin>>stgender;

Cout<<\n enter the age”;

Cin>>stage;

}

Void display ()

{

Cout<<”\n name :”<<stname;

Cout<<”\n gender :”<< stgender;

Cout<,”\n age :”<< stage;

}

};

Void main ()

{

Student obj;

Obj. getdata ();

Obj.dispay ();

getch ();

}



Related posts:

  1. Array of class objects Array of class objects and single inheritance A program consisting...
  2. Array Of Class Object Array of class objects Array is a collection of similar...
  3. Inheritance in C++ Inheritance in C++ Inheritance is one of the most important...
  4. Inline Function Inline Function The inline function is designed to speed up...
  5. Abstract Base Class Abstract base class It is a class which consists of...