4.8

#define  _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;


struct ww_service
{
	char name[30];
	double diameter;
	double weight;
};
int main()
{
	ww_service* pizza=new ww_service;
	cout << "Enter the diameter of the pizza: ";
	cin >> pizza->diameter;
	cin.get();//消除输入流中滞留的换行符的影响
	cout << "Enter the company of this pizza: ";
	cin.getline((*pizza).name, 30);
	cout << "Enter the weight of the pizza: ";
	cin >> pizza->weight;
	cout << "The information of this pizza as follow:\n ";
	cout << "Company name is: " << pizza->name << endl;
	cout << "The diameter about the pizza is: " << pizza->diameter << " centimeter."<<endl;
	cout << "The weight about the pizza is: " << pizza->weight <<" kilogram."<<endl;
	return 0;
}
	


你可能感兴趣的:(C++)