Like Tree1Likes
  • 1 Post By c99tutorial

WAP to remove vowel string using Pointer and Function

This is a discussion on WAP to remove vowel string using Pointer and Function within the C Programming forums, part of the General Programming Boards category; WAP to remove vowel string using Pointer and Function pls help...

  1. #1
    Registered User Pallav Mahamana's Avatar
    Join Date
    Jan 2013
    Posts
    2

    WAP to remove vowel string using Pointer and Function

    WAP to remove vowel string using Pointer and Function


    pls help

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,672
    Want A Poster to read this and this before making demands for homework on a plate.

    You make an effort first, then we help.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Nov 2012
    Posts
    1,194
    First is to clarify the problem: remove vowel string? Do you mean to remove certain characters ('a', 'e', 'i', ...) from a string? If so, say exactly which characters. For example, is 'y' a vowel?

    Next, as Salem mention, is to try something yourself and then ask for help on details.

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    For a second there, I thought we were inbound to the LZ: WAP, WAP, WAP, WAP,WAP.

  5. #5
    Registered User Pallav Mahamana's Avatar
    Join Date
    Jan 2013
    Posts
    2
    Code:
    #include<stdio.h>
    void remvow(char *);
    void main()
    { char str[20];
    printf("Enter String :");
    gets(str);
    remvow(str);
    }
    
    void remvow(char *t)
    {while(*t!='\0')
    {if(*t!='a'||*t!='e'||*t!='i'||*t!='o'||*t!='u')
    printf("%c",*t);
    t++;}
    }
    Heres my code but it Did'nt Worked as Expected
    Can anyone Figure out The Problem.
    It is Compiling and Runing but not Removing Vowel

  6. #6
    Registered User
    Join Date
    Nov 2011
    Location
    Saratoga, California, USA
    Posts
    334
    The logical OR operator is an 'inclusive' OR. So, if ANY of your expressions evaluates to true, the printf() is executed.

    If you think about it, you need all of the expressions to be true simultaneously - therefore use the logical AND operator - &&.

  7. #7
    Registered User
    Join Date
    Nov 2012
    Posts
    1,194
    Write it in English first

    if not (is a vowel)

    if not ('a' or 'e' or 'i' or 'o' or 'u')

    Then convert it to C

    Code:
    if(!(*t=='a'||*t=='e'||*t=='i'||*t=='o'||*t=='u'))

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 01-15-2012, 05:09 AM
  2. Pointer to function with string
    By WSUstudent in forum C Programming
    Replies: 1
    Last Post: 10-10-2011, 06:37 PM
  3. string pointer passed to a function help
    By BrandNew in forum C Programming
    Replies: 7
    Last Post: 03-07-2011, 10:08 AM
  4. string(pointer to function)
    By Darkinyuasha1 in forum C Programming
    Replies: 11
    Last Post: 11-30-2006, 01:07 PM
  5. Passing string along function. Pointer.
    By Cheeze-It in forum C++ Programming
    Replies: 4
    Last Post: 06-23-2002, 07:23 PM

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