Top.Mail.Ru
Ответы

Error C2061: синтаксическая ошибка: идентификатор "cout"

В чем ошибка?
#include
#include

using namespace std;

int main () {
int price = 0;
int cash = 100;
int section;
string Basket;
int Cheese = 5;
int Milk = 2;
int Cream = 3;
string Accept;
string localBasket_1;
string localBasket_2;
string localBasket_3;
cout << "Hello! You are in the shop. Choise section: ";
cin >> section;
switch (section) {
case 0:
cout << "You are in the hall of shop. There is nothing interesting here. Choise next floor: ";
break;
case 1:
cout << "You are in the dairy section. You have " << cash << " dollars. Look at price:" << endl;
cout << "Cheese - 5 dollars." << endl;
cout << "Milk - 2 dollars" << endl;
cout << "Cream - 3 dollars" << endl;
cout << "What you want to buy: ";
cin >> localBasket_1;
if (localBasket_1 == "Cheese") {
cash = cash - 5;
} else if (localBasket_1 == "Milk") {
cash = cash - 2;
} else if (localBasket_1 == "Cream") {
cash = cash - 3;
} else {
cout << "This product does not exist";
localBasket_3[0] = 0;
}
cout << "In basket are: " << localBasket_1 << endl;
cout << cash << endl;
while

cout << "You want to get something more?";
cin >> Accept;
while ( Accept == "Yes" || "yes" )
{
cout << "What you want to buy: ";
cin >> localBasket_2;
if (localBasket_2 == "Cheese") {
cash = cash - Cheese;
} else if (localBasket_2 == "Milk") {
cash = cash - Milk;
} else if (localBasket_2 == "Cream") {
cash = cash - Cream;
} else {
cout << "This product does not exist";
localBasket_3[0] = 0;
}
if (localBasket_2 == "Milk" || "Cream" || "Cheese")
cout << "In basket are: " << localBasket_1 << ", " << localBasket_2 << endl;
cout << cash << endl;
}
cout << "You want to get something more? ";
cin >> Accept;
while ( Accept == "Yes") {
cout << "What you want to buy: ";
cin >> localBasket_3;
if (localBasket_1 == "Cheese") {
cash = cash - 5;
} else if (localBasket_3 == "Milk") {
cash = cash - 2;
} else if (localBasket_3 == "Cream") {
cash = cash - 3;
} else {
cout << "This product does not exist";
localBasket_3[0] = 0;
}
cout << "In basket are: " << localBasket_1 << ", " << localBasket_2 << ", " << localBasket_3 << endl;
cout << cash << endl;
}
break;
default:
cout << "This section does not exist! Choose '1' or '0'";
cin >> section;
}
return 0;
}

По дате
По рейтингу
Аватар пользователя
8лет

У тебя в начале #include ничего не делает.. Абсолютно
#include
В начале должно быть