peogram converts vowels..

This is a discussion on peogram converts vowels.. within the C++ Programming forums, part of the General Programming Boards category; I need to write a program that converts vowels to "*" can you give me some tips about it....

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    34

    peogram converts vowels..

    I need to write a program that converts vowels to "*" can you give me some tips about it.

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    What are you holding the characters in and are you familiar with pointers?
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    34
    I am familiar with pointers and I am holding characters with array

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    So one way would be to set up another character array containg the vowels. Outer loop (i=0; i<strlen(string); i++) inner loop (j=0; j<5; j++) and test string[i] against vowels[j] if there is a match string[i] = '*'.

    This is assuming you have 5 vowels in your second array.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  5. #5
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    there are functions in <cstring> for dealing with c style strings.
    check out std::strpbrk(your_string,"aeiouAEIOU") and how that can help you.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  6. #6
    Registered User
    Join Date
    Oct 2002
    Posts
    34
    thank you very much

  7. #7
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    what about standard 'if' statements?

    Code:
    for(i=0;i<strlen(string);i++)
       if(string[i]=='A'||
          string[i]=='a'||
          string[i]=='E'||
          string[i]=='e'||
          string[i]=='I'||
          string[i]=='i'||
          string[i]=='O'||
          string[i]=='o'||
          string[i]=='U'||
          string[i]=='u')
             string[i]='*';
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  8. #8
    i want wookie cookies the Wookie's Avatar
    Join Date
    Oct 2002
    Posts
    455
    it takes up more room (coding wise) and its (i think) slower

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Counting Vowels within a string.
    By patso in forum C Programming
    Replies: 12
    Last Post: 04-09-2008, 04:21 PM
  2. Count the number of vowels, consonants, digits etc.
    By kumar14878 in forum C Programming
    Replies: 3
    Last Post: 05-09-2005, 12:34 AM
  3. Replies: 1
    Last Post: 03-06-2005, 09:12 AM
  4. counting vowels
    By trippedwire in forum C++ Programming
    Replies: 10
    Last Post: 10-01-2004, 11:58 PM
  5. Trying to count vowels in a string assignment
    By NCCMelissa in forum C Programming
    Replies: 8
    Last Post: 04-16-2002, 12:25 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21