1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int main()
{
struct data
{
string country;
string fathername;
int age;
};
data NAME;
data name[5]={"Ali", "Usman", "Sarmad", "Awais", "Junaid"};
name[0]=(struct data){"Saudi Arabia","Tahir Awan",24};
name[1]=(struct data){"England","Akram Khan",20};
name[2]=(struct data){"China","Amjad Ali",20};
name[3]=(struct data){"Syria","Ahmad Ali",19};
name[4]=(struct data){"Oman","Zohaib Sultan",24};
cout << "Enter Name of student/n";
cin >> NAME;
int j;
for(int i=0; i<6; i++)
{
if(NAME==name[i])
j=i;
}
cout << "We have following data for " << name[j]<< endl;
cout << "Country: " << name[j].country << endl << "Father name: " << name[j].fathername << endl << "Age: " << name[j].age << endl;
return 0;
}
|