need help!

hello friends!my program doesn't work properly.in line 114 when i want to enter a name for second time "masoud.exe has stopped working" message appears.can anybody say me where is the bug?.....thank you.

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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#include<iostream>
    using namespace std;
int main()
{   
	   struct tm{
			char month[20];
			char meridian[20];
			int day;
			int year;
			int hour;
			int minute;};
				   
	
	
	
        struct database{
	                char pilot_name[100];
	                char plane_name[100];
	                char offset[100];
	                char destination[100];
	                int capacity;
	                char customer_surename[100][100];
	                char customer_lastname[100][100];
	                int reserved;
					int fly_number;
					tm fly_time;};

    cout<<"hello  how many flies do you want to enter?\n";
    int fly_num;//numbers of flies user enters
    
    cin>>fly_num;
    
    database fly[fly_num];
    for(int i=0;i<fly_num;i++) {
		
		cout<<"enter fly number\n";
		
        cin>>fly[i].fly_number;
        
        cout<<"enter fly pilot-name\n";
        
		cin>>fly[i].pilot_name;
		
		cout<<"enter fly plane-name\n";
		
		cin>>fly[i].plane_name;
		
		cout<<"enter fly offset\n";
		
		cin>>fly[i].offset;
		
		cout<<"enter fly destination\n";
		
		cin>>fly[i].destination;
		
		cout<<"enter fly-capacity\n";
		
		cin>>fly[i].capacity;
		
		cout<<"enter fly_time year\n";
		
		cin>>fly[i].fly_time.year;
		
		cout<<"enter fly_time month (enter fly month in string form)\n";
		
		cin>>fly[i].fly_time.month;
		
		cout<<"enter fly_time day\n";
		
		cin>>fly[i].fly_time.day;
		
		cout<<"enter fly_time hour\n";
		
		cin>>fly[i].fly_time.hour;
		
		cout<<"'pm'   or   'am'?\n";
		
		cin>>fly[i].fly_time.meridian;
		
		cout<<"enter fly_time minute\n ";
		
		cin>>fly[i].fly_time.minute;
		
		cout<<"do you want to enter another fly?   y/n\n";
		char user_choice;
		cin>>user_choice;
		if (user_choice == 'y')
		continue;
		if (user_choice == 'n')
		break;}
		for(int i=0;i<fly_num;i++) {
			    
			    cout<<"parvaze shomare :        "<<fly[i].fly_number<<endl<<"pilot :                  "<<fly[i].pilot_name<<endl<<"plane :                  "<<fly[i].plane_name<<
			    endl<<"offset :                 "<<fly[i].offset<<endl<<"destination :            "<<fly[i].destination<<endl<<"capacity :               "<<fly[i].capacity<<endl
			    <<"fly time :               "<<fly[i].fly_time.year<<"  "
				<<fly[i].fly_time.month<<"  "<<fly[i].fly_time.day<<"    "<<fly[i].fly_time.hour<<":"<<fly[i].fly_time.minute
				<<" "<<fly[i].fly_time.meridian<<endl<<endl<<endl;

                }
                
                char a='y';
                
                while(a == 'y'){
					
					cout<<"\n\nhello mr/mrs which fly do you want to reserve?\n\n";
					
                    int customer_choice;
                    cin>>customer_choice;
                    
                    if(fly[customer_choice-1].capacity>0){
						
                     cout<<"enter your surename \n";
                    
                    cin>>fly[customer_choice-1].customer_surename[fly[customer_choice-1].reserved];
                    
                    cout<<"enter your lastname \n";
                    
                    cin>>fly[customer_choice-1].customer_lastname[fly[customer_choice-1].reserved];

                     
                      

                    cout<<"\nyour fly-ticket has been reserved.\n\n\n";
                    cout<<"you choosed fly number :"<<customer_choice<<endl;
                    
                    fly[customer_choice-1].capacity-=1;
                    
                    fly[customer_choice-1].reserved+=1;

                    
                    cout<<"\ndo you want to reserve another fly? y/n\n";
                    
                    cin>>a;
                    
                    if(a == 'y')
                    continue;
                    if(a == 'n')
                    break;}
                    
                    
                    
                            if(fly[customer_choice-1].capacity == 0){
									
				     		cout<<"\nsorry! this fly doesn't have empty sit!\n\n\n";
									
							cout<<"\ndo you want to reserve another fly? y/n\n";
                    
                            cin>>a;
                    
                            if(a == 'y')
                             continue;
                             if(a == 'n')
                             break;}	
									  
                    
                }

          
              cout<<"\nentire reservation report: \n\n";
              
              for(int i=0;i<fly_num;i++) {
			    
		    cout<<"parvaze shomare :        "<<fly[i].fly_number<<endl<<"pilot :                  "<<fly[i].pilot_name<<endl<<"plane :                  "<<fly[i].plane_name<<
		    endl<<"offset :                 "<<fly[i].offset<<endl<<"destination :            "<<fly[i].destination<<endl<<"remained capacity :      "<<fly[i].capacity<<endl
            <<"number of reserved tickets :     "<<fly[i].reserved<<endl<<endl<<endl;


                }
              
               

               cout<<"people who reserved tickets :\n";
               
               for(int i=0;i<fly_num;i++) {
				
				for(int j=0;j<fly[i].reserved;j++) {
					
					cout<<"parvaze shomare : "<<fly[i].fly_number<<"  "<<fly[i].customer_surename[j]<<"  "<<fly[i].customer_lastname[j]<<endl<<endl;


                        }

                                          }



   
		            

return 0;

    
								
                                          	

}

Last edited on
1) Please enclose your code in code tags. This will make it easier to read. Use the "<>" button to the right of the edit window.

2) What do you mean by "doesn't work properly"? What behaviour are you seeing? How does it differ from the behaviour you expect to see?
Topic archived. No new replies allowed.