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:
- Array of structure Array of structure It is well known that array is...
- Structure in C++ Structure in C++ Structure is a collection of simple variables...
- C++ Program Using Constructor and Destructor This is an object oriented programming in c++ to create...
- Array of class objects Array of class objects and single inheritance A program consisting...
- Array Of Class Object Array of class objects Array is a collection of similar...