multiple errors

I'm receiving a list of errors that is preventing me from running my program

138 F:\Access\Programming\assignment.cpp expected `}' at end of input
138 F:\Access\Programming\assignment.cpp expected `while' at end of input
138 F:\Access\Programming\assignment.cpp expected `(' at end of input
138 F:\Access\Programming\assignment.cpp expected primary-expression at end of input
138 F:\Access\Programming\assignment.cpp expected `)' at end of input
138 F:\Access\Programming\assignment.cpp expected `;' at end of input
138 F:\Access\Programming\assignment.cpp expected `}' at end of input
closed account (2LzbRXSz)
Those are pretty self explanatory errors - you just need to add those to your code where they're missing :)
What help do you expect without posting your code?
#include<iostream>
#include <iomanip>
#include <locale>

using namespace std;

int main()
{

int Menulist;
int number;
int choice;
string username = "";
string password = "";
bool loginSuccess = false;
float amount;
float quant;
double VAT = 17.5;
float Cp;
float tax;
float total;
double ster = 30.50;
double lther = 530.99;
double gps = 301.90;
double modified = 370.50;
double custom = 1257.99;


system("color 8f");
cout<<fixed<<showpoint<<setprecision(2);
int answer , price, standard ;

do{
cout << "Username: ";
cin >> username;
cout << "Password: ";
cin >> password;

if(username == "Carlton" && password == "MrSmith")
{
cout << "\nSuccessful Login\n\n\n";
loginSuccess = true;
}
else{
cout << "Incorrect username password combo \n";
cout << "Please try again.\n\n";
}
while(!loginSuccess)

cout<<"Welcome to Auto Cars Menulist: \t\n1: Standard \t\n2: Sport \t\n3: Personilize \t\n0: Quit"<<endl;
cin>>Menulist;
{

// loop until sentinel value read from user

switch(Menulist)
{
case 1:

cout<<"tStandard\n";
cout<<"Stereo System\n";
cout<<"Leather Interior\n";
cout<<"Modified\n";
cout<<"Would you like to trade in your old car?";
cout<<"Enter 1 for Yes or enter 2 for No \n";
cin>>answer;

if(answer == 1 )
{
cout<<"Price of old car";
cin>>price;
cout<<"is 20000\n";
cout<<"17.5%";
standard = ((20000 * 17)/100) + (2000);
cout<<"Cost of standard car is:\n"<<standard-price;



}
else if(answer == 2)
{
cout<<"Standard is 20000\n";
cout<<"17.5%";
standard = ((20000 * 17)/100) + (20000);
cout<<"Cost of standrd car is:\n "<<standard;
}

break;

case 2:

cout<<"Sport\n";
cout<<"Stereo System\n";
cout<<"Leather Interior\n";
cout<<"GPS\n";
cout<<"Modified\n";
cout<< "Enter price of car (Do not enter price if trading in)";
cin>> Cp;
amount = (quant + Cp + ( ster + gps + lther + modified));
tax = amount * VAT;
total = amount + tax;

cout<< "Cost of new car: "<<(amount)<< endl;
cout<< "Car tax: "<<(tax)<< endl;
cout<< "Final total of new car: "<< (total)<< endl;
if ((total))
cout << "Transaction complete. \n";
else
cout << "Transaction incomplete. \n";

system("pause");
return 0;
break;

case 3:

cout<<"Personilize\n";
cout<<"leather Interior\n";
cout<<"GPS\n";
cout<<"Customized Detailing\n";
cout<< "Enter price of car (Do not enter price if trading in)";
cin>> Cp;
amount = (quant + Cp + ( lther + gps + custom));
tax = amount * VAT;
total = amount = tax;

cout<< "Cost of new car: "<<(amount)<< endl;
cout<< "Car tax: "<<(tax)<< endl;
cout<< "Final total of new car: "<< (total)<< endl;
if ((total))
cout << "Transaction complete. \n";
else
cout << "Transaction incomplete. \n";

system("pause");
return 0;
}
}
This is my code. The message comes right at the end of the last bracket.
closed account (2LzbRXSz)
1
2
cout<< "Cost of new car:
"<<(amount)<< endl;

1
2
cout<<"Welcome to Auto Cars Menulist: \t\n1: Standard  \t\n2: Sport
    \t\n3: Personilize  \t\n0: Quit"<<endl;

1
2
3
4
cout<< "Cost of new car:                               
                    "<<(amount)<< endl;
                    cout<< "Car tax:                                       
                    "<<(tax)<< endl;

Should be
cout<< "Cost of new car:"<<(amount)<< endl;

cout<<"Welcome to Auto Cars Menulist: \t\n1: Standard \t\n2: Sport \t\n3: Personilize \t\n0: Quit"<<endl;

1
2
cout<< "Cost of new car:                               "<<(amount)<< endl;
                    cout<< "Car tax:                                       "<<(tax)<< endl;


Those are all of the quote errors, I believe (maybe that was just my compiler, since you weren't having the error).

As for the bracket errors, you were missing 2 brackets and a while at the end of your do while loop. It's okay, it happens. When having loops in loops in loops, sometimes you lose track of your brackets.
Your do-while loop can't loop without the while!
http://www.cplusplus.com/doc/tutorial/control/

1
2
3
4
5
6
system("pause");
                    return 0;
            }
        }
    }while(/* while */);
}
Last edited on
My compiler doesn't like the () around words like tax and amount. Try without the () around these words during your cout statements. Unless the situation of a function.... system("pause")... This is okay. Although, I can't say I agree with system pause.
If your using visual studio, just debug your program with Ctrl+F5. This allows you to see the results of your code before it closes. Its a "Start Without Debugging" feature. Cheers!
@nadurraXII - Get a better compiler. There is nothing wrong with parentheses around variables in a cout statement. From a lexical point of view, the parentheses change the variable name to an expression, but expressions are legal in a cout statement.

@OP: Reasonable use of indentation helps to spot problems with missing braces. Also, a good IDE will highlight braces pairs for you making it easy to see when braces are not paired.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
http://v2.cplusplus.com/articles/jEywvCM9/
It makes it easier to read your code and it also makes it easier to respond to your post.
Hint: You can edit your previous post, highlight your code and press the <> formatting button.
Topic archived. No new replies allowed.