1

1

1

 

// page 99-100 
int main(int argc, char *argv[]) {
int r1, r2;
while(1){
//r2 = 'A';
//r2 = 65
r2 = 065;
printf("請輸入ASCII Code=");
scanf("%d", &r1);
printf( "ASCII code %d 顯示<%c>\n", r1, r1);
printf( "ASCII 0x%X 顯示<%c>\n", r2, r2);
}
return 0;
}
 
 
// page 99-100 
int main(int argc, char *argv[]) {
char myname[] = {"My name is Johnson \n"};
char i = 0;
int  val;
while(myname[i]) {
val = myname[i];
printf( "<%c> ASCII=<%d>= <%X>\n",val,val,val );
++i;
}
return 0;
}
 
// page 99-100 
int main(int argc, char *argv[]) {
//                          111111111
//                0123456789012345678
char myname[] = {"My name is Johnson \n"};
char i = 0;
int  val;
while(myname[i]) {
val = myname[i];
printf( "%d <%c> ASCII=<%d>= <%X>\n",i,val,val,val );
//printf( "%d \t<%c> ASCII=\t<%d>= \t<%X>\n",i,val,val,val );
++i;
}
return 0;
}