Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function named isVowel that accepts a character and returns true if the

ID: 3622718 • Letter: W

Question

Write a function named isVowel that accepts a character and returns true if the character is a vowel or false otherwise.

Write a function named removeVowels that accepts a string and removes all vowels from the string and returns the new string as its return value. Note this function should call the isVowel function.

Write a main program that reads an unknown number of lines of text from a text file name "text.txt". Your program should write an output file named "removed.txt" which contains the characters which are in the input file that are not vowels.

Explanation / Answer

please rate - thanks

you didn't specify what language.

I did C++, it can easily be changed to C or Java--message me if that's necessary

#include <iostream>
#include <fstream>
using namespace std;
bool isVowel(char);
string removeVowel(string);
int main()
{ifstream in;
ofstream out;
string input,removed;
in.open("Text.txt");
if(in.fail())           
       { cout<<"input file did not open please check it ";
        system("pause");
        return 1;
        }
out.open("removed.txt");
out<<"The text with the vowels removed is: ";
getline(in,input);
while(in)
   {removed=removeVowel(input);
    out<<removed<<endl;
    getline(in,input);
    }
in.close();
out.close();
return 0;
}
string removeVowel(string in)
{int i;
string s="";
for(i=0;in[i]!='';i++)
    if(!isVowel(in[i]))
        s=s+in[i];
return s;
}
bool isVowel(char in)
{
     switch(in)
   { case 'a':
     case 'A':
     case 'e':
     case 'E':
     case 'i':
     case 'I':
     case 'o':
     case 'O':
     case 'u':
     case 'U':      return true;
   }              
return false;                              
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote