C++ Program Using Structure





A structure can be said as, the collection of  datas under a single name.

This program is designed to read and display name, roll no, address and weight of a student by using structure.

#include<iostream.h>

#include<conio.h>

Struct School

{

Int roll;

Char name [25];

Char address [25];

Float weight;

} stu;

Void main ()

{

Cout<<”\n enter the roll no”;

Cin>>stu.roll;

Cout<<”\n enter name”;

Cin>>stu.name;

Cout<<”\n enter address”;

Cin>>stu.address;

Cout<<”\n ether weight”;

Cin>>stu.weight;

Cout<<”\n the student details are:”;

Cout<<”\n Name :”<< stu.name;

Cout<<”\n Roll no”<<stu.roll;

Cout<<”\n address”<<stu.address;

Cout<<”\n weight”<<stu.weight;

getch ();

}



Related posts:

  1. Array of structure Array of structure It is well known that array is...
  2. Structure in C++ Structure in C++ Structure is a collection of simple variables...
  3. C++ Program Using Constructor and Destructor This is an object oriented programming in c++ to create...
  4. Array of class objects Array of class objects and single inheritance A program consisting...
  5. Array Of Class Object Array of class objects Array is a collection of similar...