Recent

Comments

Follow us on Facebook

Monday 1 January 2018

Write a program to enter data into a structure variable of array type that has 10 elements and each record contains three fields.

Write a program to enter data into a structure variable of array type that has 10 elements and                                                     each record contains three fields.

#include<iostream>
using namespace std;

struct student
{
char fname[50];
char sname[50];
int id;
unsigned int  phone;

};
main()
{
student s[3];
for(int i=0; i<3; i++)
{
cout<<"enter the data of student"<<i+1<<endl;
cout<<"enter the 1st name of the student"<<endl;
cin>>s[i].fname;
cout<<"enter the 2nd name of the student"<<endl;
cin>>s[i].sname;
cout<<"enter the id of the student :"<<endl;
cin>>s[i].id;
cout<<"enter the phone number of the student:"<<endl;
cin>>s[i].phone;

 }
 system("CLS");
cout<<"      name    \t      id       \t     phone  "<<endl;
for(int i=0; i<3; i++)
{
cout<<i+1<<"  "<<s[i].fname<<" "<<s[i].sname<<"  \t    "<<s[i].id<<"     \t    "<<s[i].phone<<endl;
}


}




0 on: "Write a program to enter data into a structure variable of array type that has 10 elements and each record contains three fields."

Write a program, that takes 16-Elements in Two-Dimensional-Array that has 4 rows & 4 columns, then display the diagonal of Matrix.

Write a program, that takes 16-Elements in Two-Dimensional-Array that has 4 rows & 4 columns, then display the diagonal of Matrix. ...

propeller ads

PropellerAds