Menu
CoddyTech

练习实验室 #3

Coddy C++ 文件处理 课程的第 15 课,共 23 课。

challenge icon

挑战

简单

编写一个程序,对于给定的 input.txt 文件,将以下内容写入 output.txt 文件:

  • 从每一行中删除数字,并将新的一行追加到 output.txt
  • 统计你删除的数字,并在新的一行中输出数字的个数(不会有连续的数字)
  • 追加字母数字字符的数量。(不包括删除的数字)

亲手试试

#include <iostream>
#include <fstream>
#include <cctype>

using namespace std;

int main() 
{
    
    // 在这里输入你的代码
    
    
    
    // 不要修改下面的代码!
    ifstream file("output.txt");
    string line;
    while(!file.eof()){
        getline(file, line);
        cout << line << endl;
    }
    file.close();
}

C++ 文件处理中的所有课

自己练习: C++ 在线编译器