So I'm new to C++ and I am doing a project that requires the creation of a menu for a simple game.
The project instructions are:
Write a program that will ask the user to purchase a vehicle for their character in a racing game. Tell them how much their character has to spend. Give them a menu of options for buying: 1-Mustang ($55,000), 2-Harley Davidson Motorcyle ($49,000), 3-Jeep ($35,000), 4-Sasuki GSX ($31,000). Use the switch statement and determine how much money the user has left. If the user types in a number other than 1-4, print the message: "Sorry can't process that choice!". The character starts with $60,000. Print the amount of money the character has left.
The code that I have started writing is below:
//This program will allow a user to purchase a car in a racing game
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int choice ; //to hold menu choice
int charBudget=60000;
//price for vehicle
const double
Mustang = 55,000
Harley Davidson=49,000
Jeep =35,000
Sasuki= 31,000
//constants for menu choices
Mustang = 1,
Harley Davidson=2,
Jeep=3,
Sasuki=4;
//Tell user characters budget
cout<<"You have $60,000 to spend"<< endl;
//Give the user some instructions
cout <<"Enter 1-4 to make your choice" << endl;
//Display the menu to the user
cout<< "\t\t Vehicle options for character \n\n"
<< "1. Mustang 55,000\n"
<< "2. Harley Davidson Motorcycle 49,000\n"
<< "3. Jeep 35,000 \n"
<< "4. Sasuki GSX 31,000\n"
<< "Enter your choice: ";
cin>> choice;
//set numeric output formatting.
cout<<fixed <<showpoint <<setprecision(10);
//respond to users menu selection
switch (choice)
{
case 1:
cout<< 60,000-55,000 << endl;
case 2:
cout<<60,000-49,000 <<endl;
case 3:
cout<<60,000- 35,000<< endl;
case 4:
cout<<60,000-31,000<<endl;