#include <iostream>
#include <cstdlib>
int main()
{
using namespace std;
const int arsize= 7;
char name[arsize];
char dessert [arsize];
int i=0;
do{
i++;
cout<<"Enter your name:\n";
cin.get(name,arsize);
if(i>=2)
{ cin.get();}
cout<<"Enter your favorite dessert: \n";
cin.get(dessert,arsize);
cout<<"Now I have some delicious|"<<dessert<<"|for you ,"<<name<<" .\n";
}while(i<=arsize);
system("pause");
/* **************
cin.getline(name,20);
cout<<"Enter your favorite dessert:\n";
cin.getline(dessert,20);
cout<<"Now I have some "<<dessert<<" for "<<name<<endl;
*********************/
return 0;
}运行结果测试如下:
目前暂无任何回答
- 0 回答
- 0 关注
- 1449 浏览
添加回答
举报
0/150
提交
取消