istream& getline ( istream &is , string &str , char delim );
istream& getline ( istream& , string& );
is 進行讀入操作的輸入流
str 存儲讀入的內容
delim 終結符
基本介紹
- 中文名:getline
- 別名:istream & getline
- 本質:全局函式
- 返回值:與參數is是一樣的
- 領域:編程
- 退出循環:ctrl+Z
簡述
返回值
功能
#include <string>//getline包含在string頭檔案里#include <iostream>using namespace std;int main(){ string str; getline(cin , str , '#'); char c = getchar(); cout << str << ' ' << c << endl; return 0;}


