双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

getline两次调用输出不正常

阿七-萌 阿七-萌 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#include<iostream>
int main()
{
using namespace std;
const int Artsize=20;
char name[Artsize];
char dessert[Artsize];

cout<<"Enter your name: \n";
//cin.getline(name,Artsize);
cout<<"Enter your favorite dessert: \n";
cin.getline(dessert,Artsize);
cout<<"I have some delicious "<<dessert;
cout<<" for you "<<name<<".\n";
return 0;
}
大家好,新手请帮忙。
第二次输入字符串,按enter键后,调试串口就关闭了,后面的输出没了,为什么

...全文

相关推荐

评论 10
收藏 已收藏
分享
返回顶部
阿七-萌
C++ 语言 65,214 成员 250,514 内容