zoukankan      html  css  js  c++  java
  • getline

    基本格式

    1 istream &getline( char *buffer, streamsize num, char delim );
    2  
    3 istream &getline( char *buffer, streamsize num );

    其中的buffer、num、delim的意思分别

    buffer: 进行读入操作的输入流

    num 存储读入的内容

    delim 终结符

      such as:
    string line; getline(cin,line,'?'); cout<<line; return 0;

    输入:hello?world
    输出:hello(注意?之后的东西是读不进去的)

    一个比较好的用处就是分割字符串(配合一下stringstream)

  • 相关阅读:
    164-268. 丢失的数字
    163-20. 有效的括号
    Sword 30
    Sword 29
    Sword 27
    Sword 25
    Sword 24
    Sword 22
    Sword 21
    Sword 18
  • 原文地址:https://www.cnblogs.com/zhmlzhml/p/12669967.html
Copyright © 2011-2022 走看看