#include <iostream> #include <string> struct Pizza { std::string company; double diameter; double weight; }; int main() { Pizza* ppizza = new Pizza; std::cout << "请输入pizza的信息:" << std::endl; std::cout << "pizza的直径是:" << std::endl; std::cin >> ppizza->diameter; std::cin.get(); std::cout << "pizza的生产公司是:" << std::endl; //std::cin.getline(ppizza->company); getline(std::cin, ppizza->company, '\n'); std::cout << "pizza的重量为:"; std::cin >> ppizza->weight; std::cout << "pizza的公司是:" << ppizza->company << ". " << std::endl; std::cout << "pizza的直径是:" << ppizza->diameter << std::endl; std::cout << "pizza的重量是:" << ppizza->weight << std::endl; delete ppizza; return 0; }