Write a C++ program as per the following instructions:
(i) Write a C++ code which reads the contents of a text file “first_file.txt”
(ii) Write a function named vowel_words() which will segregate the words starting with vowels
from the “first_file.txt”
(iii) Write a C++ code which writes the resultant words to the output file, “second_file.txt”.
Example: Content of first_file – “I am going to buy an umbrella”
Output in second_file.txt – I am an umbrella
1
Expert's answer
2015-08-03T03:51:59-0400
#include <iostream> #include <string> #include <fstream> using namespace std;
void segregateWords(string str);
void main() { ifstream inFile; string words;
inFile.open("first_file.txt");
while (inFile >> words) { segregateWords(words); }//end while loop
Comments
Leave a comment