I tried to rewrite everything the code but still need some help on the array thingy

Jun 4, 2016 at 8:48am
HELP ME PLEASE I NEED TO STORE THE CAR INFORMATION AND PRINT OUT THE INFORMATION

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
  #include <iostream>
#include <string>
#include <vector>
using namespace std;

class Vehicle
{
	protected:
		string Manufacturer;
		string Type;
		int Seatnumber;
	public:
		Vehicle()
		{   
			Manufacturer="";
			Type="";
			Seatnumber=1;
		};
		Vehicle(string manufacturer,string type,int seatnumber)
		{   Manufacturer=manufacturer;
			Type=type;
			Seatnumber=seatnumber;
		};
		void setmanufacturer(string manufacturer)
		{   Manufacturer=manufacturer;
		};
		void settype(string type)
		{	Type=type;
		};
		void setseatnumber(int seatnumber)
		{	Seatnumber=seatnumber;
		};
		string getmanufacturer()
		{   return Manufacturer;
		}
		string gettype()
		{	return Type;	
		};
		int getseatnumber()
		{	return 	Seatnumber;
		};
};
class Car: public Vehicle
{
	protected:
		string Carplatenumber;
		string Model;
	public:
		Car():Vehicle()
		{
			Carplatenumber="";
			Model="";
		};
		Car(string carplatenumber, string model)
		{	Carplatenumber=carplatenumber;
			Model=model;
		};
		void setcarplatenumber(string carplatenumber)
		{	Carplatenumber=carplatenumber;
		};
		void setmodel(string model)
		{	 Model=model;
		};
		string getcarplatenumber()
		{	return Carplatenumber;	
		};
		string getmodel()
		{	return Model;	
		};
		void display();
};
inline void Car::display(){

	cout<<Manufacturer;
	cout<<Type;
	cout<<Seatnumber;
	cout<<Carplatenumber;
	cout<<Model;
	
};
int main ()
{ 
	char choice;
	int size=0,seats;
	Car car[size];
	string manufacturer,type,carplatenumber,model;
	cout<<"Please choice a selection: ";
	cin>>choice;
	switch(choice){
		case 'A':
			cout<<"How many cars information do you want to store in it : ";
			cin>>size;
			cout<<"\n";
			for(int i=0;i<size;i++){
				cout << "Enter car "<<i+1<<" Manufacturer : ";
				cin >> manufacturer;
				car.setmanufacturer(manufacturer);
				cout << "Enter car "<<i+1<<" Type : ";
				cin >> type;
				car.settype(type);
				cout << "Enter car "<<i+1<<" Seatsnumber of the car : ";
				cin >> seats;
				car.setseatnumber(seats);
				cout << "Enter car "<<i+1<<" Model : ";
				cin >> model;
				car.setModel(model);
			}
			break;
		case'B':
			cout << "Hi,there please update your carplatenumber after u have gone through your new car!";
			cin >> carplatenumber;
			car.setCarplatenumber(carplatenumber)
 			break;
 		case'C':
 			int c=0;
 			cout<<"Hi,which car of information would like to print our!";
 			cin>>c;
 			cout<<car[c].display();
 			break;
 		case'D':
 			cout<<"Here you go!";
 			cout<<"========================";
 			for(int i=0;i<=size;i++){
 				car[i].display();
 				cout<<"=======================";
			 }
			 break;
		default:cout<<"Invalid input";
	}
Jun 4, 2016 at 9:07am
closed account (48T7M4Gy)
http://www.cplusplus.com/forum/beginner/192198/
Jun 4, 2016 at 9:09am
closed account (48T7M4Gy)
http://www.cplusplus.com/forum/beginner/192206/
Jun 4, 2016 at 9:23am
that one doesn't help i tried again and again i need use this kind of code
Jun 4, 2016 at 9:32am
closed account (48T7M4Gy)
I recommend you discontinue making multiple posts on what is basically the same program/topic.

If you update your program at various stages then just make the latest version a new post and not a brand new topic otherwise there is duplication of effort and you creating the possible misunderstanding that you just want everybody else to do your homework.

Pick one thread that suits your latest effort and forget the others you've opened. :)
Jun 4, 2016 at 9:36am
closed account (48T7M4Gy)
Just put a green tick on the one's that are settled and that way they won't be revisited by anybody. Leave only one open.
Topic archived. No new replies allowed.