Amazon.com Widgets Chapter 12 Exercises 2-7
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 24, 2014, 11:41:58 AM
Home Help Search chat Login Register 
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+ Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+ Old Stuff
| |-+ Answers to Exercises
| | |-+ Chapter 12
| | | |-+ Chapter 12 Exercises 2-7
Pages: [1] Go Down
Print
Author Topic: Chapter 12 Exercises 2-7 (Read 551 times)
Nick Harvey
Newbie
*
Posts: 19






on: March 20, 2012, 03:01:11 AM

Here are my solutions for Exercises 2-7. I preferred to create myMIN and myMAX to avoid getting a warning that I am overwriting a system provided function.

#define myMIN(a,b) ((a) < (b) ? (a) : (b))
#define myMAX(y,z) ((y) > (z) ? (y) : (z))
#define MAX3(a,b,c) ((a) > (b) ? myMAX(a,c) : myMAX(b,c))
#define IS_UPPER_CASE(a) (((a) >= 'A') && ((a) <= 'Z'))
#define IS_LOWER_CASE(a) (((a) >= 'a') && ((a) <= 'z'))
#define IS_ALPHABETIC(a) ((IS_LOWER_CASE(a)) || (IS_UPPER_CASE(a)))
#define IS_NUMERIC(a) (((a) >= 0) && ((a) <= 9))
#define IS_DIGIT(a) (((a) >= '0') && ((a) <= '9'))
#define IS_SPECIAL(a) ((!IS_ALPHABETIC(a)) && (!IS_NUMERIC(a)) && (!IS_DIGIT(a)))
#define ABSOLUTE_VALUE(a) ((a) < 0 ? -(a) : (a))
Logged
Pages: [1] Go Up
Print
Jump to:



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.