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

Q) write a C++ program that prompts the user toinput a string. The program then

ID: 3618583 • Letter: Q

Question

Q) write a C++ program that prompts the user toinput a string. The program then uses the function "substr" toremove all the vowels from the string. For example, if str ="There", then after removing all the vowels from the string, str ="Thr". After removing all the vowels, output the string. Yourprogram must contain a function to remove all the vowels and afunction to determine whether a character is a vowel. Can any body help me with this program, and would be greatlyappreciated. Q) write a C++ program that prompts the user toinput a string. The program then uses the function "substr" toremove all the vowels from the string. For example, if str ="There", then after removing all the vowels from the string, str ="Thr". After removing all the vowels, output the string. Yourprogram must contain a function to remove all the vowels and afunction to determine whether a character is a vowel. Can any body help me with this program, and would be greatlyappreciated.

Explanation / Answer

#include<iostream.h>

char vowels[6] ="aeiou";
char* outputString;
int isVowel(char c)
{
for(int i=0;i<5;i++)
{  
  if(vowels[i] == c)
  {   
   return 1;
  }
}
return 0;
}

int substr(char*inputStrings,int strLength)
{
int nRes=0;
int count = 0;
for(int i=0;i<strLength;i++)
{
  nRes = isVowel(inputStrings[i]);
  if(nRes == 0)
  {   
   outputString[count] = inputStrings[i];
   count++;
  }
}
return count;
}

int main()

{
int strlength=0;
char* inputString;
cout<<"Enter the string length : ";
cin>> strlength;
   
cout<<" please enter the string : ";
cin>>inputString;

int nCount =substr(inputString,strlength);
for(int i=0;i<nCount;i++)
{
  cout<<""<<outputString[i];
}
return 0;
}