Need help with assignment

Hi, Last time this was really helpful. I am trying to get my C++ program to allow the customer to choose the type of car the user wants to buy and the quantity, then the program needs to return the price the customer owns. Here is the code I have thus far, any ideas would be wonderful:

#include <iostream>
#include <string>
using namespace std;

int main ()
{
//Request information from user
string mystr;
cout << "Hello, please enter your name to get started.";
getline (cin, mystr);
cout << "Hello " << mystr << ", welcome.\n";
cout << "What is your home address? ";
getline (cin, mystr);
cout << "Thank you, you entered " << mystr << ". Please enter your home phone number.";
getline (cin, mystr);
cout << "Thank you, you entered " << mystr << ".\n";

//Variable declaration
class productInfo
string products [] = { "Mustang", "Camaro", "Nova", "Challenger", "Corvette" };
string descriptions [] = { "1969 Black Shelby", "1969 Red Camaro", "1970 Pink Nova", "1968 Blue Challenger", "1963 Teal Corvette" };
string prices [] = { "23000", "20000", "18000", "16500", "19200" };

//Display the items for sale
cout<< "Please choose a classic car you would like to purchase. The following is a list of the cars for sale and a brief description. " << endl;
cout<< "( Mustang ) 1969 Black Shelby Mustang " << endl;
cout<< "( Camaro ) 1969 Red Camaro " << endl;
cout<< "( Nova ) 1970 Pink Nova" << endl;
cout<< "( Challenger ) 1968 Blue Challenger" << endl;
cout<< "( Corvette ) 1963 Teal Corvette" << endl;


//Customer selection
int size = sizeof (4)/sizeof (4);
cout<< "Enter the type of car you would like to purchase";

//I cant figure this part out. The code needs to allow the customer to pick the car and quantity then return how much the customer is going to owe. I have tried everything.
switch(products)
{
if (Mustang==23000)
cout<< Mustang*quantity;

if (Camaro==20000)
cout<< Camaro*quantity;

if (Nova==18000)
cout<< Nova*quantity;

if (Challenger==16500)
cout<< Challenger*quantity;

if (Corvette==19200)
cout<< Corvette*quantity;

}
return 0;
}



Last edited on
Topic archived. No new replies allowed.