2019-04-17对get函数的理解

理解:

get函数本身是一个函数;函数里面包括两个步骤:第一个:保存输入的字符串包括空格,回车,遇到回车才停止保存,注意他也把回车保存。第二个:不断循环返回保存的字符串。
c=cin.get()
cin.get(s,10)//获取九个字符,s为地址 数组地址等等

#include
#include
using namespace std;
int main()
{
 char c;
while(cin.get(c))
{
if(c=="\n")break;
cout.put(c);
}
    system("pause");
    return 0;
}

你可能感兴趣的:(2019-04-17对get函数的理解)