How to write this program in a file?

How to write this program in a file. And i need to add 10 more case but i am out of ideas it's not necessary but my mark will be higher if i do it.

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
  #include<iomanip.h>
#include<iostream.h>
 #include<stdlib.h>
 #include<conio.h>

 struct plane{
 char brand[10],model[10];int year;float price;}*t;
 int i,n;char c;
 main(){
 cout<<"Dati nr de avioane";cin>>n;
 t=new avion[n];
 for(i=0;i<n;i++){
 cout<<"Dati datele despre avion"<<i+1<<endl;
 cout<<"brand";cin>>t[i].brand;
 cout<<"model";cin>>t[i].model;
 cout<<"year";cin>>t[i].year;
 cout<<"price";cin>>t[i].price;
 }
 do{
 system("cls");

 cout<<"Afisati"<<endl<<"1-all planes"<<endl;
 cout<<"2-expensive planes >100000$"<<endl;
 cout<<"3-planes with an average price <50000$"<<endl;
 cout<<"4-cheap planes <20000$"<<endl;
 cout<<"5- business class planes >200000$"<<endl;
 cout<<"6-very expensive planes >1000000$"<<endl;
 cout<<"7-the most expensive planes that exist >5000000$"<<endl;
 cout<<"8-planes for an avarage person  >10000$"<<endl;
 cout<<"9-planes for billionaires >1000000000$"<<endl;
 cout<<"A-there are no such prices >1000000000000"<<endl;
 cout<<"0-Iesire";
 c=getch();
 switch(c){
 case'1':cout<<"all planes"<<endl;
cout<<setw(12)<<"Brand"<<setw(12)<<"Model";
cout<<setw(12)<<"Year"<<setw(8)<<"Price"<<endl;
for(i=0;i<n;i++){
cout<<setw(12)<<t[i].brand<<setw(12)<<t[i].model;
cout<<setw(12)<<t[i].year<<setw(8)<<t[i].price<<endl;
}

 getch();break;
 case'2':cout<<"expensive planes"<<endl;
 cout<<setw(12)<<"Brand"<<setw(12)<<"Model";
 cout<<setw(12)<<"Year"<<setw(8)<<"Price"<<endl;
 for(i=0;i<n;i++) if(t[i].price>=100000){
 cout<<setw(12)<<t[i].brand<<setw(12)<<t[i].model;
 cout<<setw(12)<<t[i].year<<setw(8)<<t[i].price<<endl;
 }
 getch();break;



 case'3':cout<<"planes with an avarage price"<<endl;
 cout<<setw(12)<<"Brand"<<setw(12)<<"Model";
 cout<<setw(12)<<"Year"<<setw(8)<<"Price"<<endl;
 for(i=0;i<n;i++) if(t[i].price>=100000){
 cout<<setw(12)<<t[i].brand<<setw(12)<<t[i].model;
 cout<<setw(12)<<t[i].year<<setw(8)<<t[i].price<<endl;
 }
 getch();break;
  case'4':cout<<"cheap planes"<<endl;
 cout<<setw(12)<<"Brand"<<setw(12)<<"Model";
 cout<<setw(12)<<"Year"<<setw(8)<<"Price"<<endl;
 for(i=0;i<n;i++) if(t[i].price<=20000){
 cout<<setw(12)<<t[i].brand<<setw(12)<<t[i].model;
 cout<<setw(12)<<t[i].year<<setw(8)<<t[i].price<<endl;
 }
 getch();break;
  case'5':cout<<"business class planes"<<endl;
 cout<<setw(12)<<"Brand"<<setw(12)<<"Model";
 cout<<setw(12)<<"Year"<<setw(8)<<"Price"<<endl;
 for(i=0;i<n;i++) if(t[i].price>=200000){
 cout<<setw(12)<<t[i].brand<<setw(12)<<t[i].model;
 cout<<setw(12)<<t[i].year<<setw(8)<<t[i].price<<endl;
 }
 getch();break;
  case'6':cout<<"very expensive planes"<<endl;
 cout<<setw(12)<<"Brand"<<setw(12)<<"Model";
 cout<<setw(12)<<"Year"<<setw(8)<<"Price"<<endl;
 for(i=0;i<n;i++) if(t[i].price>=1000000){
 cout<<setw(12)<<t[i].brand<<setw(12)<<t[i].model;
 cout<<setw(12)<<t[i].year<<setw(8)<<t[i].price<<endl;
 }
 getch();break;
  case'7':cout<<"the most expensive planes that exist"<<endl;
 cout<<setw(12)<<"Brand"<<setw(12)<<"Model";
 cout<<setw(12)<<"Year"<<setw(8)<<"Price"<<endl;
 for(i=0;i<n;i++) if(t[i].price>=5000000){
 cout<<setw(12)<<t[i].brand<<setw(12)<<t[i].model;
 cout<<setw(12)<<t[i].year<<setw(8)<<t[i].price<<endl;
 }
 getch();break;
  case'8':cout<<"planes for an avarage person"<<endl;
 cout<<setw(12)<<"Brand"<<setw(12)<<"Model";
 cout<<setw(12)<<"Year"<<setw(8)<<"Price"<<endl;
 for(i=0;i<n;i++) if(t[i].price>=10000){
 cout<<setw(12)<<t[i].brand<<setw(12)<<t[i].model;
 cout<<setw(12)<<t[i].year<<setw(8)<<t[i].price<<endl;
 }
 getch();break;
  case'9':cout<<"planes for billionaires"<<endl;
 cout<<setw(12)<<"Brand"<<setw(12)<<"Model";
 cout<<setw(12)<<"Year"<<setw(8)<<"Price"<<endl;
 for(i=0;i<n;i++) if(t[i].price>=1000000000){
 cout<<setw(12)<<t[i].brand<<setw(12)<<t[i].model;
 cout<<setw(12)<<t[i].year<<setw(8)<<t[i].price<<endl;
 }
 getch();break;
  case'A':cout<<"there are no such prices"<<endl;
 cout<<setw(12)<<"Brand"<<setw(12)<<"Model";
 cout<<setw(12)<<"Year"<<setw(8)<<"Price"<<endl;
 for(i=0;i<n;i++) if(t[i].price>=1000000000000){
 cout<<setw(12)<<t[i].brand<<setw(12)<<t[i].model;
 cout<<setw(12)<<t[i].year<<setw(8)<<t[i].price<<endl;
 }
 getch();break;
 }
 }while(c!='0');
 delete[]t;}
Topic archived. No new replies allowed.