本文共 655 字,大约阅读时间需要 2 分钟。
输入文本如下:
12345 23455 65477 3463423355 55456 56666 3566723445 63456 24566 2464524545 24545 24555 2345523455 24355 24356 24356
代码如下:
/* 读取每行的第二个整形数值 */ #include结果如下:#include #include using namespace std; int main(){ int temp1,m; string s; char buffer[30]; ifstream fin; fin.open("number.txt",ios::in); if(!fin.is_open()){ cout<<"Error opening file";exit(1); } //读取每行的第二个整形数值 /*//法一 while(!fin.eof()){ fin>>temp1>>m>>temp1>>temp1; cout< < >m; fin.getline(buffer,30); cout< <