Hi All I am trying to write a simple program using cases to select the option.
Below i have copied some of the program in.
Basically what i am looking to do. When you enter 1 it selects seat and prints out that seat has been selected. What i am trying to do now is to make a variable called Make1 and store seat in it. Then make another variable in the private details called make 2.
When i call the show car data at the bottom i want it to display seat but am having problems doing so.
The code i have pasted below is not the full program just some of it copied on here.
Can anyone please tell me how to do this?
Thanks
Steve
class Car_Details //Name of class is Car_Details
{
private:
int Make;
public:
void CarData (void)
{
cout << "\nPlease Select Make of Car: i.e Enter 1 for Seat\n"
<< " 1. Seat:\n"
<< " 2. Bmw :\n"
<< " 3. Volkswagen:\n"
<< " 4. Ford:\n"
<< " 5. Mercedes:\n"
<<" 6. Renault:\n";
cin >> Make;
switch( Make)
{
case 1:
cout << "Car Selected is a Seat\n";
{
Price1 = 40;
char Make1= "seat";
Make2 = Make1;
}
break;
switch( Make )
{
case 2:
cout << "Car Selected is a Bmw\n";
{
Price1 = 100;
}
break;
void Show_Car(void)
{
cout <<"\nMake is: "<<Make2;
cout <<endl;
}
Below i have copied some of the program in.
Basically what i am looking to do. When you enter 1 it selects seat and prints out that seat has been selected. What i am trying to do now is to make a variable called Make1 and store seat in it. Then make another variable in the private details called make 2.
When i call the show car data at the bottom i want it to display seat but am having problems doing so.
The code i have pasted below is not the full program just some of it copied on here.
Can anyone please tell me how to do this?
Thanks
Steve
class Car_Details //Name of class is Car_Details
{
private:
int Make;
public:
void CarData (void)
{
cout << "\nPlease Select Make of Car: i.e Enter 1 for Seat\n"
<< " 1. Seat:\n"
<< " 2. Bmw :\n"
<< " 3. Volkswagen:\n"
<< " 4. Ford:\n"
<< " 5. Mercedes:\n"
<<" 6. Renault:\n";
cin >> Make;
switch( Make)
{
case 1:
cout << "Car Selected is a Seat\n";
{
Price1 = 40;
char Make1= "seat";
Make2 = Make1;
}
break;
switch( Make )
{
case 2:
cout << "Car Selected is a Bmw\n";
{
Price1 = 100;
}
break;
void Show_Car(void)
{
cout <<"\nMake is: "<<Make2;
cout <<endl;
}