-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path4_13_8.cpp
More file actions
28 lines (28 loc) · 772 Bytes
/
4_13_8.cpp
File metadata and controls
28 lines (28 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include<iostream>
#include<string>
using namespace std;
struct William
{
string company_name;
double pizza_diameter;
double pizza_weight;
};
int main()
{
William * pizza = new William;
cout << "Enter the diameter of the pizza: ";
cin >> pizza->pizza_diameter;
cout << "Enter the name of the company: ";
cin.get(); //输入直径后,输入队列中还有换行符
getline(cin, pizza->company_name);
cout << "Enter the weight of the pizza:";
cin >> pizza->pizza_weight;
cout << "pizza: ";
cout << "\tCompany: " << pizza->company_name << endl
<< "\tdiameter: " << pizza->pizza_diameter << endl
<< "\tweight: " << pizza->pizza_weight << endl;
delete pizza;
cin.get();
cin.get();
return 0;
}