C++ Program using Stadd() and Stshow()





This program is designed in-order to take input  of 5 students data’s and displays them at the end. The class named “student” is declared in the program. There are two access specifier named private and public.

This program stores the information like name, age ,gender etc and displays them in the end of the program. This program uses member function stadd()  and stshow().

#include<iostream.h>

#include<conio.h>

Class student

{

Private:

Char name [25];

Char gender;

Int age;

Public:

Void stadd ();

{

Cout<<”\n Enter your name”;

Cin>>name;

Cout<<”\n Enter your gender”;

Cin>>gender;

Cout<<”\n Enter your age”;

Cin>>age;

}

Void stshow ()

{

Cout<<”\n Name=”<<name;

Cout<<”\n Gender=”<<gender;

Cout<<”\n Age=”<<age;

}

};

Void main ()

{

Student obj [5];

For (i=0; i<5; i++)

{

Obj[i].stadd ();

}

For (i=0; i<5; i++)

{

Obj[i].stshow ();

}

getch ():

}



Related posts:

  1. C++ Program Using getdata() and display() The program uses member function getdata() and display() in-order to...
  2. Array of class objects Array of class objects and single inheritance A program consisting...
  3. C++ Program Using Constructor and Destructor This is an object oriented programming in c++ to create...
  4. Array Of Class Object Array of class objects Array is a collection of similar...
  5. Inheritance in C++ Inheritance in C++ Inheritance is one of the most important...