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;
    }

  • 相关阅读:
    JSP内置对象
    java 中list还有array的区别
    js动态修改界面碰见的疑惑
    购物多条件商品查询逻辑处理
    数据库信息备份
    关于毕设的一些小问题
    在<a></a>标签中正确调用javaScript脚本
    oracle实训0705经验
    第十五天学习进度--数列找规律算法(预测算法)(1)
    第十四天学习进度--相关系数和显著水平
  • 原文地址:https://www.cnblogs.com/2014acm/p/3877793.html
Copyright © 2011-2022 走看看