zoukankan      html  css  js  c++  java
  • C++ 中的“读一行” getline(cin , s) cin.getline(s, 100)

    #include<string>
    using namespace std;
    int main(int argc, char *argv[])
    { 
      string s;
      cin>>s;
      cout<<s<<endl;;
        
        return 0;
    }
    View Code

    #include <iostream>

    #include<string>

    using namespace std;

    int main(int argc, char *argv[])

    {      

     string s;

      cin>>s;

      cout<<s<<endl;

       return 0;

    }

    ****************************************************************************************************************************

    #include <iostream>
    
    #include<string>
    
    using namespace std;
    
     
    
    int main(int argc, char *argv[])
    
    {   
    
      string s;
    
         getline( cin, s)  ;
    
            cout<<s<<endl;
    
        return 0; }
    
     
    View Code

    #include <iostream>

    #include<string>

    using namespace std;

    int main(int argc, char *argv[])

    {  

      string s;

         getline( cin, s)  ;

            cout<<s<<endl;

        return 0; }

    #include <iostream>
    #include<string>
    using namespace std;
    int main(int argc, char *argv[])
    {
        string s;
        while (getline(cin,s))
            cout<<s<<endl;
    
        return 0;
    }
    View Code

    #include <iostream>

    #include<string>

    using namespace std;

    int main(int argc, char *argv[])

    {   

      string s;

        while (  getline( cin, s)  )

            cout<<s<<endl;

        return 0; }

     

    *********************************************************************************************************

    #include <iostream>
    #include <string>
    using namespace std;
    main ()
    {
             char s[100];
             cin.getline (s, 100);
             cout << name <<endl;
    }

  • 相关阅读:
    一个封装好的使用完成端口的socket通讯类
    IOCP编程注意事项
    判断socket是否连接(windows socket)
    CRITICAL_SECTION同步易出错的地方
    OCP-1Z0-053-V13.02-43题
    OCP-1Z0-053-V13.02-24题
    OCP-1Z0-053-V13.02-490题
    OCP-1Z0-053-V12.02-456题
    OCP-1Z0-053-V12.02-447题
    OCP-1Z0-053-V13.02-710题
  • 原文地址:https://www.cnblogs.com/2014acm/p/3877793.html
Copyright © 2011-2022 走看看