Thread: Help (conditions in user defined functions)!

  1. #1
    Registered User
    Join Date
    Sep 2016
    Posts
    1

    Help (conditions in user defined functions)!

    I am having trouble with a portion of my code...

    // takes one character argument and returns and integer
    //change the letter to uppercase (use ctype.h)
    //return a 1 if the letter is in the first half of the alphabet(A-M)
    //return a 2 if the letter is in the second half of the alphabet (N-Z)
    int FunctionTwo(char arg1);


    Not sure how to create that condition Please help!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    So if you're assuming the ASCII encoding sequence for characters, then all you really need to know is

    if ( ch <= 'M' )

    The rest you should be able to manage.
    Or at least post some actual code attempt.
    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. User-defined functions
    By naya22 in forum C++ Programming
    Replies: 6
    Last Post: 04-10-2007, 11:25 AM
  2. User defined functions
    By alexpos in forum C Programming
    Replies: 2
    Last Post: 10-23-2005, 02:53 PM
  3. New to user defined functions
    By Extropian in forum C Programming
    Replies: 4
    Last Post: 08-15-2005, 10:45 PM
  4. user-defined functions
    By MyntiFresh in forum C++ Programming
    Replies: 22
    Last Post: 07-10-2005, 01:11 PM
  5. Help! User defined functions
    By AdrenalinFlow in forum C Programming
    Replies: 3
    Last Post: 02-22-2003, 07:36 PM

Tags for this Thread