You are on page 1of 9

Ch11.

Topics and Objectives

(ASCII)

Intelligent Robotics Lab.

CPU , .
CPU ,
.

ASCII (American Standards Committee for Information Interchange) code

ASCII code


, , : 128 (7
)
, (1 )
32
Intelligent Robotics Lab.

ASCII code table (See Appendix A)

Intelligent Robotics Lab.

ASCII code 7 ,
1 char

// 11-1.c
#include <stdio.h>
int main(void)
{
char ch1 = A;
char ch2 = B;
char ch3 = C;

printf(%c%c%c \n, ch1, ch2, ch3);


return 0;

printf %c

Intelligent Robotics Lab.

ASCII code

ASCII code , char



char ch = A;

char ch = 65;

ASCII code
printf %c ASCII code ASCII code
.

Intelligent Robotics Lab.

isdigit

ctype.h
, 0
// 11-2.c
#include <stdio.h>
#include <ctype.h>
int main(void)
{
char ch = 0;

ch
0 0

if( isdigit(ch) )
printf(". \n");
else
printf(" . \n");
return 0;

Intelligent Robotics Lab.

isalpha

ctype.h
, 0
// 11-3.c
#include <stdio.h>
#include <ctype.h>
int main(void)
{
char ch = a;

ch

0

if( isalpha(ch) )
printf(". \n");
else
printf(" . \n");
return 0;

Intelligent Robotics Lab.

islower

,
0

isupper

// 11-4.c
#include <stdio.h>
#include <ctype.h>
int main(void)
{
char ch = A;

if( islower(ch) )
printf(". \n");

,
0

if( isupper(ch) )
printf(". \n");
}

return 0;

Intelligent Robotics Lab.

Home Work

. (
source ),
p. 231 11-1. ASCII code

1~2

p. 234 11-2.

Intelligent Robotics Lab.

You might also like