Thread: Uppercase check with 2 functions

  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    3

    Question Uppercase check with 2 functions

    Hi everyone. I'm having a tough time figuring out this c programming problem. It can only use <stdio.h> and here is the problem:

    Write a program which includes a user defined function named 'upper' . The function is passed a single char. It will return 1 if the char is upper case, i.e. between ‘A’ and ‘Z’. It will return 0 otherwise. Your main function will ask the user to enter input char, call the function, and
    print out the answer.

    If anyone could help me with this I'd be really appreciative! Thanks!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    if ( ch == 'A' ) return 1;


    Copy/paste 25 more times with suitable edits, put it in a function, and you're done.

    EBCDIC - Wikipedia, the free encyclopedia
    In case your tutor decides to downgrade you because you didn't use some semi-obvious one-liner.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. string uppercase
    By pktcperlc++java in forum C++ Programming
    Replies: 2
    Last Post: 08-01-2005, 06:59 PM
  2. Uppercase and lowercase
    By StarOrbs in forum C++ Programming
    Replies: 4
    Last Post: 03-09-2005, 04:18 PM
  3. Uppercase Hex
    By Vicious in forum C++ Programming
    Replies: 12
    Last Post: 07-11-2004, 07:29 PM
  4. Graph functions check
    By Munkey01 in forum C++ Programming
    Replies: 3
    Last Post: 02-19-2003, 04:50 PM
  5. Uppercase & Lowercase
    By Dennis in forum C Programming
    Replies: 2
    Last Post: 11-14-2002, 08:07 AM

Tags for this Thread