working on capitolization program

This is a discussion on working on capitolization program within the C Programming forums, part of the General Programming Boards category; So I working on a program that is supposed to accept all letters and make the vowels uppercase. the problem ...

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    4

    Question working on capitolization program

    So I working on a program that is supposed to accept all letters and make the vowels uppercase. the problem I am having is the isvowel part. I am not sure how to make it work correctly. I think I have the basic structure down, and am probably missing something minor to get it to work. I am a newbie so any help would be greatly appreciated. Oh and I am not sure how to make the or symbol with my computer so that would probably be a good start to helping me.

    here's what I have

    Code:
    #include <ctype.h>
    
    int main(void)
    {
    int c, isvowel();
    
    while ((c=getchar()) !=EOF)
    if (is vowel(c))
    putchar(toupper(c));
    else
    putchar(c);
    return 0;
    
    int isvowel(c)
    {...}

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Well you could start by making your function compare the passed argument with each vowel to see if it matches.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    Start with
    Code:
    int isvowel(c)
    {
        return 1;
    }
    Then refine the content of the function until it actually does what you want it to.

  4. #4
    cwr
    cwr is offline
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    868
    It also smells like you're trying to define the function isvowel() inside main. C doesn't allow nested functions.

  5. #5
    Registered User
    Join Date
    Feb 2006
    Posts
    17
    Code:
    c = tolower(c);
    if (c == 'a' || c == 'e' || ...)
        ...
    That should get you started.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. Replies: 5
    Last Post: 02-02-2003, 09:56 AM
  3. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 11:39 AM
  4. Simple Program not working right (in C)
    By DruzeTito in forum C Programming
    Replies: 5
    Last Post: 06-01-2002, 10:14 PM
  5. Program ive been working on called ChatMate
    By dirkduck in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 01-23-2002, 08:05 PM

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