Сделал задание A , посмотрите правильно ли сделал ? Код #include <iostream> #include <cstdlib> #include<cstdio> using namespace std; struct ship { string color="Pig"; int speed=228; }; int main() { setlocale(LC_ALL, "Russian"); ship Ship; cout << "Цвет корабля " + Ship.color; cout << endl; cout << "Скорость корабля " << Ship.speed << " км/ч"; return 0; } Код #include <iostream> #include <cstdlib> #include<cstdio> using namespace std; struct ship { string color="Pig"; int speed=228; }; int main() { setlocale(LC_ALL, "Russian"); ship Ship; cout << "Цвет корабля " + Ship.color; cout << endl; cout << "Скорость корабля " << Ship.speed << " км/ч"; return 0; }
KASPAY, Да, в принципе все окей, но лучше не сразу инициализировать структуру каким-то значениями, но этот вариант имеет право на жизнь.