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 c[20];
 7     int ch;
 8     cout<<"please enter a sentence:"<<endl;
 9     cin.getline(c,15,'/');
10     cout<<"The first part is:"<<c<<endl;
11     ch=cin.peek();
12     cout<<"The next character(ASCII code) is:"<<ch<<endl;
13     cin.putback(c[0]);
14     cin.getline(c,15,'/');
15     cout<<"The second part is:"<<c<<endl;
16     return 0;
17 }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2021-06-29
  • 2022-12-23
  • 2022-12-23
  • 2021-08-13
  • 2021-11-14
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-13
  • 2021-06-18
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
相关资源
相似解决方案