?? 例13.10.txt
字號:
例13.10用ignore函數跳過輸入流中的字符。
先看不用ignore函數的情況:
#include <iostream>
using namespace std;
int main( )
{char ch[20];
cin.get(ch,20,′/′);
cout<<″The first part is:″<<ch<<endl;
cin.get(ch,20,′/′);
cout<<″The second part is:″<<ch<<endl;
return 0;
}
將程序改為
#include <iostream>
using namespace std;
int main( )
{char ch[20];
cin.get(ch,20,′/′);
cout<<″The first part is:″<<ch<<endl;
cin.ignore( );//跳過輸入流中一個字符
cin.get(ch,20,′/′);
cout<<″The second part is:″<<ch<<endl;
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -