+-+

来自「算法」· 代码 · 共 28 行

TXT
28
字号
#include <iostream.h> 
#include <stdlib.h> 
#include <stdio.h>
#include <fstream.h> 

int main() 
{ 


     short i=1; 
     char buf[100]; 
     ifstream aa("aa.txt"); 

     while (1) { 
            
           cout << i++ << ':' ; 
           aa.seekg(0,ios::beg);//第二次循环到不了文件头,用aa.rdbuf可以显示其余的内容,但我不会按行处理其中的内容。 
           while(aa.getline(buf,100)) { 
               cout << buf << endl; 

           } 
           cout << "Please press any key to continue..."; 
           cin.get(); 
     } 

     return 0; 
} 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?