You are here:

C++/c++ file handling


Sir, I have a question related to file handling in c++.

Assume that a text file named txt1.txt already exists with some lines.Write a function named transfer() that read the file and create a new file txt2.txt which by transferring the vowels letters from txt1.txt to txt2.txt?

There are three basic things you need to know for solving this problem. After you know that you will be able to write the code yourself.
The first thing is that how do you read a text file. This can be done by using two functions; ifstream in; and“MyFile.txt”); from the fstream library. For a complete detail refer to this post:

The second step is to know how many vowels are there in the word you have read. This can be done by taking the input in character array instead of string or int (as in the post) and then comparing each element with five of the vowels. If it is a vowel write it to another text file which is txt2.txt in your case.

For the matter that how would you write it in the second file you can refer to this post:

Try writing the program now and if you encounter any problem, you can ask me here or on the blog.

Hope I helped!


All Answers

Answers by Expert:

Ask Experts




I can answer questions related to C++ coding and programming techniques.


I am a C++ programmer.

University of Engineering & Technology Lahore


I am doing BSCS.

©2016 All rights reserved.