C++ Program to Store and Display Information Using Structure



object oriented programming c++

structures in c++
This program store the information (name, fname id and department).


#include<iostream>
using namespace std;
// declaring the strct 
struct Student{
string id;
string name;
string fname;
string depart;
};
int main()
{
Student s1;
//get student info 
cout<<"Enter Your Details "<<endl<<endl;
cout<<"Enter Your ID "<<endl;
getline(cin,s1.id);
cout<<"Enter Your Department "<<endl;
getline(cin,s1.depart);
cout<<"Enter Your Name "<<endl;
getline(cin,s1.name);
cout<<"Enter Your F'Name' "<<endl;
getline(cin,s1.fname);
//displaying student info 
cout<<"Displaying Student Info"<<endl;
cout<<"Your ID  is"<<s1.id<<endl;
cout<<"Your Name is"<<s1.name<<endl;
cout<<"Your Father Name"<<s1.fname<<endl;
cout<<"Your Department is"<<s1.depart<<endl;
getchar();
return 0;
}
On Youtube Visit:




Some More exapmles are given below related to :
C++ Program to Store and Display Information Using Structure 
Structures in c++

Comments

Popular posts from this blog

C++ Program to Store and Display Information Using Structure