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 in.open(“MyFile.txt”); from the fstream library. For a complete detail refer to this post: http://recurseit.blogspot.com/2011/09/how-to-read-input-from-txt-file.html
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: http://recurseit.blogspot.com/2011/09/how-to-write-to-txt-file.html
Try writing the program now and if you encounter any problem, you can ask me here or on the blog.
Hope I helped!