Menu
Coddy logo textTech

Practice Lab #3

Lesson 15 of 23 in Coddy's C++ File Handling course.

challenge icon

Challenge

Easy

Write a program that for a given input.txt file will write the following content into the output.txt file:

  • Remove the numbers from each line and append the new line to output.txt
  • Count the numbers you've removed and print the number of digits in a newline (there won't be consecutive numbers)
  • Append the number of alphanumeric letters. (don't include the digits removed)

Try it yourself

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

using namespace std;

int main() 
{
    
    // Enter your code here
    
    
    
    // DO NOT CHANGE THE CODE BELOW!
    ifstream file("output.txt");
    string line;
    while(!file.eof()){
        getline(file, line);
        cout << line << endl;
    }
    file.close();
}

All lessons in C++ File Handling