getline两次调用输出不正常
#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键后,调试串口就关闭了,后面的输出没了,为什么
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键后,调试串口就关闭了,后面的输出没了,为什么
...全文
相关推荐
getline函数输入要击两次回车的解决办法
这个getline函数输入要击两次回车的解决办法不错..有点实用
C++中getline()、gets()等函数的用法详解
主要介绍了C++中getline()、gets()等函数的用法,本文给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
基于C++ cin、cin.get()、cin.getline()、getline()、gets()函数的使用详解
学C++的时候,这几个输入函数弄的有点迷糊;这里做个小结
C++ cin.getline及getline()用法详解
主要介绍了C++ cin.getline用法及C++ getline()的两种用法,本文通过实例代码给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
c++ getline
关于getline函数的详细方法说明,希望对刚学习c++的同胞们有点帮助



