pass the structure to the function as an agrument to display the values
#include <iostream>using namespace std;
struct student
{
char name [30];
string field;
string semester;
int rollno;
};
void dispalydata(student);
main()
{
student s;
cout<<"enter your Good name ";
cin.get(s.name,100);
cout<<"which is your field ";
cin>>s.field;
cout<<"enter your roll no ";
cin>>s.rollno;
cout<<"In which semeter you study ";
cin>>s.semester;
dispalydata(s);
return 0;
}
void dispalydata(student s)
{
cout<<"\nfollowing is your information ";
cout<<"\nNAME"<<" "<<s.name<<endl;
cout<<"ROLL NO"<<" "<<s.rollno<<endl;
cout<<"FEILD"<<" "<<s.field<<endl;
cout<<"semester"<<" "<<s.semester<<endl;
}
0 on: "Define a structure student and take values of the members in main and pass the structure to the function as an agrument to display the values"