// practice4-7.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
const int len = 70;
struct pizza
{
char brand[len];
double diameter;
double weight;
};
int _tmain(int argc, _TCHAR* argv[])
{
using namespace std;
pizza hut;
cout<<"Enter pizza brand:";
cin.getline(hut.brand,len);//每次读取整行输入
cout<<"Enter its diameter:";
cin>>hut.diameter;
cout<<"Enter its weight:";
cin>>hut.weight;
cout<<"/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/"<<endl;
cout<<"pizza brand is:"<<hut.brand<<endl;
cout<<"its diameter is:"<<hut.diameter<<endl;
cout<<"its weight is:"<<hut.weight<<endl;
system("pause");
return 0;
}
由用户对struct变量的输入输出方法
最新推荐文章于 2023-03-15 20:14:25 发布