zl程序教程

您现在的位置是:首页 >  后端

当前栏目

函数跳过输入流中的字符

字符输入 函数 跳过
2023-09-14 09:12:06 时间
 1 #include <iostream>
 2 
 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 4 using namespace std;
 5 int main(int argc, char** argv) {
 6     char ch[20];
 7     cin.get(ch,20,'/');
 8     cout<<"The first part is:"<<ch<<endl;
 9     cin.get(ch,20,'/');
10     cout<<"The second part is:"<<ch<<endl;
11     return 0;
12 }