Assuming that a text file named FIRST.TXT contains some text written into it, write a function named vowelwords(), that reads the file FIRST.TXT and creates a new file named SECOND.TXT, to contain only those words from the file FIRST.TXT which start with a lowercase vowel (i.e., with 'a', 'e', 'i', 'o', 'u').
For example, if the file FIRST.TXT contains
Carry umbrella and overcoat when it rains
Then the file SECOND.TXT shall contain
umbrella and overcoat it .. IT AN URGENT!!!!!!!!!!!!!!!!!!

Recommended Answers

Daniweb is not a homework service. We expect you to write the code you need, but will assist with specific problems or questions you might have.

Jump to Post

All 2 Replies

Daniweb is not a homework service. We expect you to write the code you need, but will assist with specific problems or questions you might have.

Here's a headstart. Regex to find words starting with a lowercase vowel.

#include <iostream>
#include <regex>
#include <string>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    regex reg("\\b[aeiou]\\S*");
    string str("Carry umbrella and overcoat when it rains");
    smatch match;

    while (regex_search(str, match, reg))
    {
        for (auto i : match)
            cout << i << endl;
        str = match.suffix().str();
    }

    return 0;
}

Here's the reference link:
regex
regex_search

commented: Stop feeding them fish, and teach them how to fish! -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.