C/C++

В чем ошибка простого кода C++?

#include

using namespace std;

int main() {
setlocale(LC_ALL, “rus”);
int a;
int b;
int c;
int plitka;
int cofe;
int moloko;
cout << "Введите цену (плитка шоколада)" <> plitka;
cout << "Введите число" <> a;
cout << "Введите цену (Кофе)" <> cofe;
cout << "Введите число" <> b;
cout << "Введите цену (Молоко)" <> moloko;
cout << "Введите число" <> c;
int sum = 0;
sum = a * plitka + b * cofe + moloko * c;
cout << "Общая цена ";
cout << sum << endl;
}
Чуть-чуть подправлю...

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
using namespace std;
struct Product {
double cost;
double count;
string name;
Product()
: cost(0), count(0) {}
Product(const string& name, double cost, double count)
: name(name), cost(cost), count(count) {}
Product(string&& name, double cost, double count)
: name(move(name)), cost(cost), count(count) {}
double total()const {
return cost * count;
}
friend istream& operator>>(istream& in, Product& p) {
auto flush = [&in] {
in.ignore(numeric_limits<streamsize>::max(), '\n');
};
cout << "Наименование товара: ";
getline(in, p.name);
if (!p.name.length()) return in;
cout << "Цена: ";
in >> p.cost;
if (0 == p.cost) {
p.name = "";
flush();
return in;
}
cout << "Количество: ";
in >> p.count;
if (0 == p.count) {
p.name = "";
p.cost = 0;
flush();
return in;
}
flush();
return in;
}
friend ostream& operator<<(ostream& out, const Product& p) {
return out << p.name << "\n\t"
<< setprecision(2) << p.cost << " x "
<< setprecision(3) << p.count << " = "
<< setprecision(2) << p.total() << '\n';
}
};
class Purchases {
public:
bool add(const Product& p) {
if (p.name.length() && p.cost && p.count) {
box.push_back(p);
return true;
}
return false;
}
bool add(Product&& p) {
if (p.name.length() && p.cost && p.count) {
box.emplace_back(p);
return true;
}
return false;
}
void total()const {
auto sum = 0.;
cout << fixed;
for (const auto& item : box) {
sum += item.total();
cout << item;
}
cout << "\t\tИтого = " << sum << '\n';
}
private:
vector<Product> box;
};
int main() {
system("chcp 1251 > nul");
Purchases pur;
Product p;
do cin >> p; while (pur.add(p));
system("cls");
pur.total();
system("pause > nul");
}
Павел Колесников
Павел Колесников
60 502
Лучший ответ
Код нужно выкладывать на ideone/pastebin
cout << "Введите цену (плитка шоколада)" <> plitka;
ошибка синтаксическая
Юрий Авраменко
Юрий Авраменко
96 460
Где то нету ;