Total members 11890 |It is currently Fri Apr 19, 2024 7:46 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





This is the instructions for the program I have to write:
Write a program that prompts the user to input a string. The program then uses the function substr to remove all the vowels from the string. For example, if str = "There", then after removing all the vowels, str = "Thr". After removing all the vowels, output the string. Your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel.

With that being said, this is the program I have written. I am not sure if it is correct or not though and I was wanting to seek help on it. Any pointers would be greatly appreciated.

Code:
int main()
{
   string str;
   void removeVowels(string str);   
   
   cout << "Enter a string: ";
   cin >> str;
   cout << endl;

   cout << "The new string is: " << removeVowels << endl;
   
   cout << "\nThe stringafter the function is: " << str << endl;
   return 0;
}

bool isVowel(char ch)
{
      if ((ch=='A')||(ch=='E')||(ch=='I')||(ch=='O')||(ch=='U')
         ||(ch=='a')||(ch=='e')||(ch=='i')||(ch=='o')||(ch=='u'))
   {
      cout << isVowel << endl;
      return true;
   }
      else
   {
      return false;
   }
   {
      cout << str.substr(isVowel) << endl;
   }
   return 0;
}





Author:
Newbie
User avatar Posts: 2
Have thanks: 1 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Remove all the vowels from a string
 How to remove special characters from a string in Java?     -  
 Splitting a String Based on a Found String     -  
 recursive string reversal- reverse string     -  
 check if string ends with specific sub-string in php     -  
 check if string start with a specific sub-string in PHP     -  
 Remove Indentation     -  
 remove page title     -  
 Add and Remove CSS classes to html tag dynamically     -  
 Remove a portion of the array and replace it with something     -  
 Remove ordered list numbers     -  



Topic Tags

C++ Strings






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com