0% found this document useful (0 votes)
4 views5 pages

Structure

Uploaded by

fu5607626
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Structure

Uploaded by

fu5607626
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Using namespace std;

Struct path {

String souce;

String dis;

};

Struct name {

String first;

String mid;

String last;

};

Struct ticket {

Int id;

Name name;

Float price;

Path path;

Bool meal;

};

Int main() { const int l=5;

Ticket t[l];

Int ch;

Int id;

String name;

String path;

Float total,ave;

Do{

Cout<<”press (1) to fill date \n”;

Cout<<”press (2) to print data \n”;


Cout<<”press (3) to search with id \n”;

Cout<<”press (4) to search with first name \n”;

Cout<<”press (5) to search with last nane \n”;

Cout<<”press (6) to search with source path \n”;

Cout<<”press (7) to see meal is avelabl for name \n”;

Cout<<”press (8) to see path \n”;

Cout<<”press (9) to see avrage of ticket price \n”;

Cout<<”press (10) to exit \n”;

Cin>>ch;

Switch(ch){

Case 1:{ for(int i=0; i<l; i++){

Cout<<”enter id \n”;

Cin>>t[i].id;

Cout<<”enter full name \n”;

Cin>>t[i].[Link]>>t[i].[Link]>>t[i].[Link];

Cout<<”enter meal \n”;

Cin>>t[i].meal;

Cout<<”enter path \n”;

Cin>>t[i].[Link]>>t[i].[Link];

Cout<<”enter price \n”;

Cin>>t[i].price;

}break;}

Case 2:{

Cout<<”id name price path meal \n”;

For(int i=0; i<l; i++){

Cout<<t[i].id<<” “;
Cout<<t[i].[Link]<<t[i].[Link]<<t[i].[Link]<<” “;

Cout<<t[i].price<<” “;

Cout<<t[i].[Link]<<”to”<<t[i].[Link]<<” “;

Cout<<t[i].meal<<endl;

} break;}

Case 3:{

Cout<<”please enter id \n”;

Cin>>id;

For(int i=0; i>l; i++){

If(t[i].id==id){

Cout<<t[i].id<<” “;

Cout<<t[i].[Link]<<t[i].[Link]<<t[i].[Link]<<” “;

Cout<<t[i].price<<” “;

Cout<<t[i].[Link]<<”to”<<t[i].[Link]<<” “;

Cout<<t[i].meal<<endl;

}break;}

Case 4:{

Cout<<”please enter frist name \n”;

Cin>>name;

For(int i=0; i>l; i++){

If(t[i].[Link]==name){

Cout<<t[i].id<<” “;

Cout<<t[i].[Link]<<t[i].[Link]<<t[i].[Link]<<” “;

Cout<<t[i].price<<” “;

Cout<<t[i].[Link]<<”to”<<t[i].[Link]<<” “;

Cout<<t[i].meal<<endl;
}

}break;}

Case 5:{ cout<<”please enter last name \n”;

Cin>>name;

For(int i=0; i>l; i++){

If(t[i].[Link]==name){

Cout<<t[i].id<<” “;

Cout<<t[i].[Link]<<t[i].[Link]<<t[i].[Link]<<” “;

Cout<<t[i].price<<” “;

Cout<<t[i].[Link]<<”to”<<t[i].[Link]<<” “;

Cout<<t[i].meal<<endl;

}break;}

Case 6:{

Cout<<”please enter souce path \n”;

Cin>>path;

For(int i=0; i>l; i++){

If(t[i].[Link]==path){

Cout<<t[i].id<<” “;

Cout<<t[i].[Link]<<t[i].[Link]<<t[i].[Link]<<” “;

Cout<<t[i].price<<” “;

Cout<<t[i].[Link]<<”to”<<t[i].[Link]<<” “;

Cout<<t[i].meal<<endl;

}break;}

Case 7:{

Cout<<”please enter last name \n”;


Cin>>name;

For(int i=0; i<l; i++){

If(t[i].[Link]==name){

Cout<<t[i].meal<<endl;}

}break;}

Case 8:{ for(int i=0;i<l; i++){

Cout<<”from”<<t[i].[Link]<<”to”<<t[i].[Link]<<”\n”;}

Break;}

Case 9:{for(int i=0; i<l; i++){

Total=0;

Total=total+t[i].price;

} ave;

Ave=total/l;

Cout<<”avrege=”<<ave<<endl;

Break;}

Case 10:{return 0;}

Default :{cout<<”wrong number \n”;}

}while(1);

System (“pause”);

You might also like