any help would be appreciated. here is my code:
and here is the errors that i am getting:
--------------------Configuration: finalproject - Win32 Debug--------------------
Compiling...
finalproject.cp p
H:\finalproject .cpp(14) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
H:\finalproject .cpp(15) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
H:\finalproject .cpp(16) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
H:\finalproject .cpp(17) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
H:\finalproject .cpp(18) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
H:\finalproject .cpp(19) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
H:\finalproject .cpp(20) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
H:\finalproject .cpp(21) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
H:\finalproject .cpp(38) : error C2065: 'choice' : undeclared identifier
H:\finalproject .cpp(45) : error C2447: missing function header (old-style formal list?)
H:\finalproject .cpp(58) : error C2001: newline in constant
H:\finalproject .cpp(59) : error C2001: newline in constant
H:\finalproject .cpp(130) : error C2447: missing function header (old-style formal list?)
Error executing cl.exe.
finalproject.ob j - 5 error(s), 8 warning(s)
Code:
// Final Project
#include <iostream.h>
#include <iomanip.h>
void checkout();
void start_or_startover();
void receipt();
float subtotal, tax, total;
// Prices
float laptopprice = 799.99;
float mouseprice = 12.99;
float keyboardprice = 29.99;
float moniterprice = 399.99;
float usbprice = 16.99;
float hdmiprice = 24.99;
float lazerprice = 6.99;
float 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" << "$" << mouseprice << "\t\t " << "$" << (mousenumber * mouseprice) << endl;
cout << "Razer Keyboard Wired \t "<< keyboardnumber << "\t\t\t" << "$" << keyboardprice << "\t\t " << "$" << (keyboardnumber * keyboardprice) << endl;
cout << "SATA USB 8GB Flash Drive \t "<< usbnumber << "\t\t\t" << "$" << usbprice << "\t\t " << "$" << (usbnumber * usbprice) << endl;
cout << "HDMI Full 1080p 6ft Cable \t "<< hdminumber << "\t\t\t" << "$" << hdmiprice << "\t\t " << "$" << (hdminumber * hdmiprice) << endl;
cout << "Lazer Pointer \t "<< lazernumber << "\t\t\t" << "$" << lazerprice << "\t\t " << "$" << (lazernumber * lazerprice) << endl;
cout << "Power Cord \t "<< powernumber << "\t\t\t" << "$" << 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;
}
--------------------Configuration: finalproject - Win32 Debug--------------------
Compiling...
finalproject.cp p
H:\finalproject .cpp(14) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
H:\finalproject .cpp(15) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
H:\finalproject .cpp(16) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
H:\finalproject .cpp(17) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
H:\finalproject .cpp(18) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
H:\finalproject .cpp(19) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
H:\finalproject .cpp(20) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
H:\finalproject .cpp(21) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
H:\finalproject .cpp(38) : error C2065: 'choice' : undeclared identifier
H:\finalproject .cpp(45) : error C2447: missing function header (old-style formal list?)
H:\finalproject .cpp(58) : error C2001: newline in constant
H:\finalproject .cpp(59) : error C2001: newline in constant
H:\finalproject .cpp(130) : error C2447: missing function header (old-style formal list?)
Error executing cl.exe.
finalproject.ob j - 5 error(s), 8 warning(s)
Comment