?? 例13.7.txt
字號:
例13.7 用getline函數讀入一行字符。
#include <iostream>
using namespace std;
int main( )
{char ch[20];
cout<<″enter a sentence:″<<endl;
cin>>ch;
cout<<″The string read with cin is:″<<ch<<endl;
cin.getline(ch,20,′/′);//讀19個字符或遇′/′結束
cout<<″The second part is:″<<ch<<endl;
cin.getline(ch,20); //讀19個字符或遇′/n′結束
cout<<″The third part is:″<<ch<<endl;
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -