to write a C++ program which will read the given text file and will produce an
output text file with the name “Email_IDs” which must contain the valid email addresses of
the students mentioned in the input text file.
#include <fstream>
using namespace std;
int main() {
string line;
ifstream in('input.txt');
ofstream out('Email_IDs');
if (in.is_open()) {
while (getline(in, line)) {
out << line << "\n";
}
}
}
Comments
Leave a comment