473,394 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

remove vowels from user input string

how to remove the vowels from the user input.?
Aug 13 '13 #1
4 3640
Expand|Select|Wrap|Line Numbers
  1. #include<iostream>
  2. #include<string>
  3. #include<sstream>
  4. using namespace std;
  5. int main()
  6. {
  7.  
  8.     char word[1000];
  9.     char b[6]={'a','e','i','o','u'};
  10.     cout<<"enter the word:\t";
  11.     cin>>word;
  12.     for(int i=0;i<=1000;i++)
  13.     {
  14.         char d=word[i];
  15.         if(d==b[0])
  16.         {
  17.  
  18.         }
  19.         else if(d==b[1])
  20.         {
  21.  
  22.         }
  23.         else if(d==b[2])
  24.         {
  25.  
  26.         }
  27.         else if(d==b[3])
  28.         {
  29.  
  30.         }
  31.         else if(d==b[4])
  32.         {
  33.  
  34.         }
  35.         else
  36.             cout<<"\r \n"<<d;
  37.     }
  38.  
  39.  
  40. }
Aug 13 '13 #2
Expand|Select|Wrap|Line Numbers
  1. #include<iostream>
  2. #include<string>
  3. #include<sstream>
  4. using namespace std;
  5. int main()
  6. {
  7.  
  8.     char word[1000];
  9.     char b[6]={'a','e','i','o','u'};
  10.     cout<<"enter the word:\t";
  11.     cin>>word;
  12.     for(int i=0;i<=1000;i++)
  13.     {
  14.         char d=word[i];
  15.         if(d==b[0])
  16.         {
  17.  
  18.         }
  19.         else if(d==b[1])
  20.         {
  21.  
  22.         }
  23.         else if(d==b[2])
  24.         {
  25.  
  26.         }
  27.         else if(d==b[3])
  28.         {
  29.  
  30.         }
  31.         else if(d==b[4])
  32.         {
  33.  
  34.         }
  35.         else
  36.             cout<<"\r \n"<<d;
  37.     }
  38.  
  39.  
  40. }
Aug 13 '13 #3
weaknessforcats
9,208 Expert Mod 8TB
The easiest thing to do is to make a copy of your input string. You would write a loop copy from your input a character at a time. Test each character to be a vowel and if it is don't copy it.

Your copy will have no vowels.

Finally, copy back to the original input.
Aug 13 '13 #4
thanks for your help
Aug 19 '13 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: agent349 | last post by:
Hi, I'm fairly new to c++. I need user input in the form of dollar amounts, ie: "$10.00". I'd like to remove the dollar sign "$" then store the rest in a variable. How do I go about removing the...
6
by: AZRebelCowgirl73 | last post by:
Here is my problem: I have two java files: One named Car.java and the other named CarDealerApp.java: In the CarDealerApp program, I read in through user input the make, model, year and price of...
1
by: Chris Carlen | last post by:
Hi: I'm writing a Python program, a hex line editor, which takes in a line of input from the user such as: -e 01 02 "abc def" 03 04 Trouble is, I don't want to split the quoted part where...
3
by: mattmao | last post by:
Hello everyone. This question is regarding ISBN number checking. I've done it with my own algorithm, which is pretty bad in consideration about the total lines of code. Now I want to improve...
14
by: jld730 | last post by:
All, I will have a user input a string that is either 10, 14, 17 characters long, or contains a comma (of any length). The script proceeds from there depending on the length entered. When I test...
12
by: Tarique | last post by:
I have tried to restrict the no. of columns in a line oriented user input.Can anyone please point out potential flaws in this method? btw.. 1.I have not used dynamic memory allocation because...
2
by: curien | last post by:
Hello, I am working on a code that takes the users input ( a string of digits) from the command line and prints out the median number. I am trying to accomplish this by: from sys import argv ...
1
by: golnaz hgh | last post by:
the xml file is like this: <publist> <book> A book entry has the following fields: o Title; o One or more authors; o Publisher; o Year </book>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.