i cant find where to put/move the bracket, and getting a error because of it.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • qwert7465
    New Member
    • Jan 2010
    • 6

    i cant find where to put/move the bracket, and getting a error because of it.

    here is my code. i am only getting one error:

    Code:
    // Final Project
    
    #include <iostream.h>
    #include <iomanip.h>		
    
    void checkout();
    void start_or_startover();
    void receipt();
    
    int choice;
    
    float subtotal, tax, total;
    
    // Prices
    double laptopprice = 799.99;
    double mouseprice = 12.99;
    double keyboardprice = 29.99;
    double moniterprice = 399.99;
    double usbprice = 16.99;
    double hdmiprice = 24.99;
    double lazerprice = 6.99;
    double powerprice = 9.99;
    
    // Quantity
    int laptopnumber;
    int mousenumber;
    int keyboardnumber;
    int moniternumber;
    int usbnumber;
    int hdminumber;
    int lazernumber;
    int powernumber;
    
    // Main Function
    int main()
    {
    	
    	do
    	{ start_or_startover(); }
    	while (choice == 10);
    
    	receipt();
    
    	return 0;
    	}
    
    {
    	cout << "Ferger's Technology Store" << endl << endl;
    
    
    	do
    	{
    	cout << "(1) HP Pavilion Intel Core 2 Duo Laptop		$799.99" << endl;
    	cout << "(2) Razer Black Wired Lazer Mouse				$12.99" << endl;
    	cout << "(3) Razer Keyboard Wired						$29.99" << endl;
    	cout << "(4) HP LCD Flatscreen Moniter					$399.99" << endl;
    	cout << "(5) SATA USB 8GB Flash Drive					$16.99" << endl;
    	cout << "(6) HDMI Full 1080p 6ft Cable					$24.99" << endl;
    	cout << "(7) Lazer Pointer								$6.99" << endl;
    	cout << "(8) Power Cord									$9.99" << endl;
        cout << endl;
    	cout << "(9) Total" << endl;
    	cout << "(10) Cancel Order" << endl;
    	cout << " Please enter the choice number of the electronics that you would like to buy." << endl << endl;
    	cin >> choice;
    	cout << endl;
    
    	if (choice == 9)
    	{
    		chechout();
    	}
    	if (choice == 1 || choice == 2 || choice == 3 || choice == 4 || choice == 5 || choice == 6 || choice == 7 || choice == 8);
    	{
    	cout << " How many would you like? ";
    	cin >> choice_amount;
    	cout << endl;
    	
    	if (choice == 1)
    	{
    		laptopnumber = choice_amount;
    	}
    
    	if (choice == 2)
    	{
    		mousenumber = choice_amount;
    	}
    
    	if (choice == 3)
    	{
    		keyboardnumber = choice_amount;
    	}
    
    	if (choice == 4)
    	{
    		moniternumber = choice_amount;
    	}
    
    	if (choice == 5)
    	{
    		usbnumber = choice_amount;
    	}
    
    	if (choice == 6)
    	{
    		hdminumber = choice_amount;
    	}
    	if (choice == 7)
    	{
    		lazernumber = choice_amount;
    	}
    	if (choice == 8)
    	{
    		powernumber = choice_amount;
    	}
    	}
    
    	if (choice == 10)
    	{
    		laptopnumber = 0;
    		mousenumber = 0;
    		keyboardnumber = 0;
    		moniternumber = 0;
    		usbnumber = 0;
    		hdminumber = 0;
    		lazernumber = 0;
    		powernumber = 0;
    	}
    
    	while (choice != 9);
    	}
    
    {
    	subtotal = (laptopnumber * laptopprice) + (mousenumber * mouseprice) + (keyboardnumber * keyboardprice) + (	subtotal = (laptopnumber * laptopprice) + (mousenumber * mouseprice) + (keyboardnumber * keyboardprice) + (	subtotal = (laptopnumber * laptopprice) + (mousenumber * mouseprice) + (keyboardnumber * keyboardprice) + (moniternumber * moniterprice) + (usbnumber * usbprice) + (hdminumber * hdmiprice) + (lazernumber * lazerprice) + (powernumber * powerprice);
    
    	tax = subtotal * .0875;
    
    	total = subtotal + tax;
    	}
    void receipt()
    	{
    	cout << "Thank you for your buisness. Here is your recipt." << endl << endl;
    	cout.setf(ios::fixed);
    	cout << "Items\t\t  " << "Number of items purchased \t Price of each item \t Total price" << endl;
    	cout << "HP Pavilion Intel Core 2 Duo Laptop \t "<< laptopnumber << "\t\t\t" << "$" << setprecision(2) << laptopprice << "\t\t   " << "$" << (laptopnumber * laptopprice) << endl;
    	cout << "Razer Black Wired Lazer Mouse \t "<< mousenumber << "\t\t\t" << "$" <<  setprecision(2) << mouseprice << "\t\t   " << "$" << (mousenumber * mouseprice) << endl;
    	cout << "Razer Keyboard Wired \t "<< keyboardnumber << "\t\t\t" << "$" << setprecision(2) << keyboardprice << "\t\t   " << "$" << (keyboardnumber * keyboardprice) << endl;
    	cout << "SATA USB 8GB Flash Drive \t "<< usbnumber << "\t\t\t" << "$" << setprecision(2) << usbprice << "\t\t   " << "$" << (usbnumber * usbprice) << endl;
    	cout << "HDMI Full 1080p 6ft Cable \t "<< hdminumber << "\t\t\t" << "$" << setprecision(2) << hdmiprice << "\t\t   " << "$" << (hdminumber * hdmiprice) << endl;
    	cout << "Lazer Pointer \t "<< lazernumber << "\t\t\t" << "$" << setprecision(2) << lazerprice << "\t\t   " << "$" << (lazernumber * lazerprice) << endl;
    	cout << "Power Cord \t "<< powernumber << "\t\t\t" << "$" << setprecision(2) << powerprice << "\t\t   " << "$" << (powernumber * powerprice) << endl;
    
    	cout << "\t\t Subtotal \t $" << subtotal << endl;
    	cout << "\t\t Tax \t\t $" << tax << endl;
    	cout << "\t\t Total \t\t $" << total << endl << endl << endl;
    }
    
    }
    and here is the error, i cant figure out what to do.:

    H:\finalproject .cpp(47) : error C2447: missing function header (old-style formal list?)
    Error executing cl.exe.

    finalproject.ob j - 1 error(s), 0 warning(s)
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    Line 39 opens and closes the braces for do-while.
    Line 45 closes the braces for function main().
    Line 47 opens a spurious brace. Is this supposed to be part of main() or the beginning of a new function?

    Comment

    Working...