自考新教材-p294

源程序:

#include<iostream>

using namespace std;

int main()

{

char str[30];

while (!cin.eof())          //当输入流没有结束时继续循环

{

cin.ignore(10, ':');    //在cin流中跳过':'之前的全部字符

if (!cin.eof())         //输入流若没有结束

{

cin >> str;          //输入电话号码

cout << str << endl;

}

}

system("pause");

return 0;

}

 运行结果:

posted @ 2020-01-27 15:16  bobo哥  阅读(130)  评论(0)    收藏  举报