1 / 9

This presentation includes custom animations.

This presentation includes custom animations. To view the animations, you must view the presentation in Slide Show mode and activeX controls must be allowed. If you have opened this lesson in PowerPoint, use the PowerPoint menus to view it in slide show mode.

aaralyn
Download Presentation

This presentation includes custom animations.

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. This presentation includes custom animations. To view the animations, you must view the presentation in Slide Show mode and activeX controls must be allowed. If you have opened this lesson in PowerPoint, use the PowerPoint menus to view it in slide show mode. If you have opened this lesson in a browser and see a bar similar to that below, click on the Slide Show icon A notice similar to the one below may appear warning that ActiveX or other scripts are disabled. Enable the controls for this website in order to see the animations.

  2. ctype.h This lesson introduces the library functions included in ctype.h: Vocabulary: ctype.h isalnum() isalpha() iscntrl() isdigit() isgraph() islower() isprint() ispunct() isspace() isupper() isxdigit() tolower() toupper() Christine S. Wolfe Ohio University Lancaster 2008-Aug-01

  3. The ctype.h header file includes several useful functions. The argument for these functions is a single char. C Primer Plus®, Third Edition by Stephen Prata. Publisher: Sams Pub Date: September 28, 1998 Print ISBN-10: 1-57169-161-8

  4. Before these functions can be used in a program, the ctype.h library must be included. #include <stdio.h> #include <ctype.h> int main() { char Response; printf("Please enter your selection: "); fflush(stdin); scanf("\n%c", &Response); if ( toupper(Response) == 'Q') { return 0; } }

  5. The ctype functions that begin with "is" are boolean. That means they return either TRUE or FALSE, the logical values. isalnum() isalpha() iscntrl() isdigit() isgraph() islower() isprint() ispunct() isspace() isupper() isxdigit()

  6. Given that the user entered 'A' as Response, what is the value of each of these expressions? isalnum(Response) isalpha(Response) iscntrl(Response) isdigit(Response) isgraph(Response) islower(Response) isprint(Response) ispunct(Response) isspace(Response) isupper(Response) isxdigit(Response) True Click for answer True Click for answer False Click for answer False Click for answer True Click for answer False Click for answer True Click for answer False Click for answer False Click for answer True Click for answer True Click for answer

  7. Given that the user entered '6' as Response, what is the value of each of these expressions? isalnum(Response) isalpha(Response) iscntrl(Response) isdigit(Response) isgraph(Response) islower(Response) isprint(Response) ispunct(Response) isspace(Response) isupper(Response) isxdigit(Response) True Click for answer False Click for answer False Click for answer True Click for answer True Click for answer False Click for answer True Click for answer False Click for answer False Click for answer False Click for answer True Click for answer

  8. The ctype functions that begin with "to" return a char value. tolower() toupper() They do NOT change the value of the argument itself. For example: Letter1 = toupper(Letter2);

  9. The argument for the ctype.h library functions MUST BE A char!!! Given the declarations below, the following statements are syntactically incorrect: int NumIn = 345; char Name[20] = "hal"; char Proper[20]; if (isDigit(NumIn)) Proper = toupper(Name); Please don't look at this slide for too long - I don't to plant these ideas in your head if they weren't already there!!!

More Related