Array problem

Hello, currently working on an rental system for fun, when input the data and try to recall it using arrays it seems not to be working ill post the code below

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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
 #include <iostream>
#include <string>
using namespace std;
class automobile {
 public :
 string car_registration;
 int total_miles_driven;
 int tank_filling_accumulation;// litres
 int number_of_repairs;
 int tax_rate;
 int insurance_group;
 int tyre_change_count;
 int seats;
 int users;
 string fuel_type;
 int fuel_size;
 void MPG();
 void NORPM();
 void AMPU();
};
void automobile::MPG()
{
 float mpg;
 mpg = total_miles_driven/tank_filling_accumulation;
 cout << "The miles per a gallons achieved was" << mpg << endl;

}
void automobile::NORPM()
{
 float repairs;
 repairs = total_miles_driven/number_of_repairs;
 cout << "The number of repairs per miles is:" << repairs << endl;
}
void automobile::AMPU()
{
 int APU;
 APU = total_miles_driven/users;
 cout << "The average miles per a user is:" << APU << endl;
}
 
class sportscars : public automobile {
public:
 bool softtop;
 bool alloys;
 sportscars(){
  seats = 2;
  tax_rate = 210;
  insurance_group = 16;
  fuel_type = "Petrol";
 }
 void sportscars_entry();
 void displaysports_cars();
};
void sportscars::displaysports_cars()
{
  cout << " SportsCars Stats";
  cout << " The SportsCars Registration is:" << car_registration;
  cout << " The SportCar has driven a total of:" << total_miles_driven;
  cout << " The tank filling accumulation is:" << tank_filling_accumulation;
  cout << " Numer of repairs :" << number_of_repairs;
  cout << " Tax Rate :" << tax_rate;
     cout << " Insurance group :" << insurance_group;
  cout << " Amount of tyre changes:" << tyre_change_count;
 cout << " The amount of seats the sport cars has is:" << seats;
 cout << " The fuel type is " << fuel_type;
 cout << " The fuel size is " << fuel_size;
}
void sportscars :: sportscars_entry() 
{
 cout << " SportsCars Entry";
  cout << " Can you please enter the car registration:";
   cin >> car_registration;
  cout << " How many miles has the car driven:"; 
  cin >> total_miles_driven;
  cout << " How big is the tank of the sports car:"; 
  cin >> tank_filling_accumulation;
  cout << " How many repairs has the car had done: :";
   cin >> number_of_repairs;
  cout << " Please type the Tax Rate :"; 
   cin >> tax_rate;
     cout << " What Insurance group is the car: :";
  cin >>insurance_group;
  cout << " How many tyre changes has the car had: :";
   cin >> tyre_change_count;
 cout << " How many seats does the sportscar had::"; 
 cin >>seats;
 cout << " What fuel does the car use: "; 
  cin >> fuel_type;
 cout << " How big is the size of the fuel tank: "; 
 cin >> fuel_size;
}
class FbyF : public automobile {
 
public:
 bool towing_hitch;
 bool road_pack;
 FbyF()
 {
  seats = 5-7;
  tax_rate = 440;
  insurance_group = 12;
  fuel_type = "Diesel";

 }
 void FbyF_entry();
 void display_FbyF_entry();
};
void FbyF :: display_FbyF_entry() {
     cout << " FbyF stats";
  cout << " The FbyF Registration is:" << car_registration;
  cout << " The  has driven a total of:" << total_miles_driven;
  cout << " The tank filling accumulation is:" << tank_filling_accumulation;
  cout << " Numer of repairs :" << number_of_repairs;
  cout << " Tax Rate :" << tax_rate;
     cout << " Insurance group :" << insurance_group;
  cout << " Amount of tyre changes:" << tyre_change_count;
 cout << " The amount of seats the sport FbyF has is:" << seats;
 cout << " The fuel type is " << fuel_type;
 cout << " The fuel size is " << fuel_size;
}
void FbyF :: FbyF_entry() {
   cout << " FbyF Entry";
  cout << " Can you please enter the car registration:";
   cin >> car_registration;
  cout << " How many miles has the car driven:"; 
  cin >> total_miles_driven;
  cout << " How big is the tank of the FbyF car:"; 
  cin >> tank_filling_accumulation;
  cout << " How many repairs has the car had done: :";
   cin >> number_of_repairs;
  cout << " Please type the Tax Rate :"; 
   cin >> tax_rate;
     cout << " What Insurance group is the car: :";
  cin >>insurance_group;
  cout << " How many tyre changes has the car had: :";
   cin >> tyre_change_count;
 cout << " How many seats does the FbyFcar had::"; 
 cin >>seats;
 cout << " What fuel does the car use: "; 
  cin >> fuel_type;
 cout << " How big is the size of the fuel tank: "; 
 cin >> fuel_size;
}
class vans : public automobile {
 
public:
 bool hight_top;
 int Capacity;
 vans()
 {
   seats = 3;
   tax_rate = 225;
   insurance_group = 11;
   fuel_type = "Diesel";
 }
 void vans_entry();
 void display_vans_entry();
};
void vans :: display_vans_entry() {
  cout << " Vans stats";
  cout << " The Vans Registration is:" << car_registration;
  cout << " The  has driven a total of:" << total_miles_driven;
  cout << " The tank filling accumulation is:" << tank_filling_accumulation;
  cout << " Numer of repairs :" << number_of_repairs;
  cout << " Tax Rate :" << tax_rate;
     cout << " Insurance group :" << insurance_group;
  cout << " Amount of tyre changes:" << tyre_change_count;
 cout << " The amount of seats the sport vans has is:" << seats;
 cout << " The fuel type is " << fuel_type;
 cout << " The fuel size is " << fuel_size << endl;
 
}
void vans :: vans_entry() {
   cout << " vans Entry";
  cout << " Can you please enter the car registration:";
   cin >> car_registration;
  cout << " How many miles has the car driven:"; 
  cin >> total_miles_driven;
  cout << " How big is the tank of the vans car:"; 
  cin >> tank_filling_accumulation;
  cout << " How many repairs has the car had done: :";
   cin >> number_of_repairs;
  cout << " Please type the Tax Rate :"; 
   cin >> tax_rate;
     cout << " What Insurance group is the car: :";
  cin >>insurance_group;
  cout << " How many tyre changes has the car had: :";
   cin >> tyre_change_count;
 cout << " How many seats does the van had::"; 
 cin >>seats;
 cout << " What fuel does the car use: "; 
  cin >> fuel_type;
 cout << " How big is the size of the fuel tank: " <<endl;
 cin >> fuel_size;
}
class booking {
public:
 int date_booked_out;
 int number_of_days_booked;
 string car_registration;
 void data_input();
 void display_booking();
};

int main()
{
	
    sportscars temp, sportcars_Arry[10]; 
 vans temp2, vans_Arry[10]; 
    FbyF temp3, FbyF_Arry[10]; 

 int sc_count=0, van_count=0, FbyF_count=0; 
 int choice, choice2,choice3;
 
 homescreen:cout << "Welcome to the Car Rental System" << endl;
 cout<< "1. Data Entry"<<'\n';
 cout<< "2. Stats Display"<< '\n';
 cin>> choice;
 switch (choice)
 {
home1: case 1: 
  {  cout << "1. SportsCar"<<'\n';
     cout<< "2. Van"<<'\n';
     cout<< "3. FbyF"<<'\n';
	 cout<< "4. Return to Home Screen"<<'\n';
	 cout<< "5. Exit"<<'\n';
     cout<<"Enter your choice"<<'\n';
     cin>> choice2;
    if (choice2 == 1)
     {
  
      sportcars_Arry[sc_count].sportscars_entry();
      sc_count++;
	  goto home1;
	  cout << "thanks for entering the data";
     }
     else if (choice2 == 2)
     {
      vans_Arry[ van_count].vans_entry();
     van_count++;
	 	  cout << "thanks for entering the data";
	 goto home1;
     }
          else if (choice2 == 3)
     {
      FbyF_Arry[FbyF_count].FbyF_entry();
      FbyF_count++;
		  cout << "thanks for entering the data";
	  goto home1;
     } 
	           else if (choice2 == 4)
     {
	  goto homescreen;
     } 
		  	           else if (choice2 == 4)
     {
	  return 0;
     } 
     break;
    }
 case 2:
  {
	  cout << "Stats Display screen"<<'\n';
    cout << "1. SportsCar Display"<<'\n';
     cout<< "2. Van  Display"<<'\n';
     cout<< "3. FbyF  Display"<<'\n';
     cout<<"Enter your choice: ";
     cin >> choice3;
     if (choice3 == 1)
     {
       string t_cr;
	cout<< "Enter the registration no: "<< t_cr;
	cin >> t_cr;
	   for(int i=0; i<sc_count;i++)
    { 
	 if (sportcars_Arry[i]. car_registration == t_cr)
      sportcars_Arry[i].displaysports_cars();
	   else{
		  cout<< "No sports car exists with the specified registration number ...!!!";
		}
         }
    }
    else if (choice3 = 2)
     {

     }
     else if (choice3 = 3)
     {
    
     } 
     break;
   }
   
 }
 system("pause");
 return 0;
}



If you can help it would great
Topic archived. No new replies allowed.