#include<iostream>
#include<string>
using namespace std;
struct pizza
{
char company[30];
double diameter;
double weight;
};
void main()
{
<span style="white-space:pre"> </span>pizza *p=new pizza;
<span style="white-space:pre"> </span>cout<<"请输入披萨的直径:";
<span style="white-space:pre"> </span>cin>>p->diameter;
<span style="white-space:pre"> </span>cin.get();
<span style="white-space:pre"> </span>cout<<"请输入披萨公司的名称:";
<span style="white-space:pre"> </span>cin.getline(p->company,strlen(p->company));
<span style="white-space:pre"> </span>cout<<"请输入披萨的重量:";
<span style="white-space:pre"> </span>cin>>p->weight;
<span style="white-space:pre"> </span>cout<<"披萨公司的名称为"<<p->company<<endl
<span style="white-space:pre"> </span><<"披萨的直径为"<<p->diameter<<endl
<span style="white-space:pre"> </span><<"披萨的重量为"<<p->weight<<endl;
<span style="white-space:pre"> </span>delete p;
}
C++primer plus第六版课后编程练习答案4.8
最新推荐文章于 2019-12-18 19:32:07 发布