美文网首页
2019-04-17对get函数的理解

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

作者: 尚恩_3295 | 来源:发表于2019-04-22 15:19 被阅读0次

    理解:

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

    #include<iostream>
    #include<stdio.h>
    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函数的理解

          本文链接:https://www.haomeiwen.com/subject/hlnsiqtx.html