I'm a college freshman with no experience in programming. Can I please have some help with errors and adding code (based on the instructions) to my project?
I need help figuring out how to execute the first option in this menu:
cout << "Would you like to empty your cart? (Y or N)" << endl;
cin >> choice;
if (choice == 'y' || choice == 'Y')
{
cout << "Choose between: " << endl;
cout << "1. A specific item" << endl;
cout << "OR" << endl;
cout << "2. The whole cart" << endl;
cin >> num;
cin.clear();
cin.ignore();
if(num == 1)
{
}
elseif(num == 2)
{
cart = " ";
}
}
else displayMenu();
And I need help with this error. Visual Studio tells me it's error C3681.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
int maintainCart(Cart info)
{
cout << "How many would you like to buy?" << endl;
cin >> info.quantity;
while (info.quantity < 1)
{
cout << "Invalid amount. You must choose one item.";
cin >> info.quantity;
}
cout << endl;
calculateSubtotal(info); // error C3681
return 0;
}
Umm can you post the full error? How are we supposed to know what c3681 is :P Anyways the neat thing about compiler errors are they tell you the line and what the error is. Only thing I can guess about your error is that you are not taking a "Cart" object as a parameter in the function calculateSubtotal.