0

I keen to write a program that reads a text from a file. Then i have to take each word from the text and change the word.
If the word begins with a vowel, add the string "yay" at the end of the word.
If the word does not begin with a vowel, rotate the word one character at a time; that is, move the first character of the word to the end of the word until the first character of the word becomes a vowel. "There" = "ereThay".
For words such as "crwth" which contain no vowels, the MPLF form adds the string "way" at the end of the word. The same applies to numbers.
If a word ends with a punctuation mark, in the MPLF form put the punctuation mark at the end of the word. "Hello!" = "elloHay!".
Write the converted words to an output file called textfileMPLF.txt.

so far i have gotten the words invividually....what do i do next?
please help!

#include <iostream>
#include <string>
#include <fstream>

using namespace std;

int main()
{

ifstream inData;
ofstream outData;
string filename;
string word;

cout << "Enter the name of the file: " << endl;
cin >> filename;
inData.open(filename.c_str());
outData.open("textfileMPLF.txt");


while (inData >> word)
{
outData << word<<endl;

}
return 0;
}
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Ancient Dragon
0

>>what do i do next
Start by testing the word to see if it begins with a vowel. You will probably want to write a series of if -- else if --- else if --- statements to test each of the requirements.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.