70,037
社区成员
发帖
与我相关
我的任务
分享

#include<iostream>
using namespace std;
char c[20] = {0};
printf("Please input a character:\n");
scanf("%s",&c); // 字符串要用 %s
char * p = c;
while (*p != '\0')
{
printf("The ASCII of %c is %d\n",*p,*p);
p++;
}
汉子无法用原先的ascll码表示,一个汉字需要2个字节来表示/*************************************************************************
> File Name: scanf_1.c
> Author: 傻李
> Mail: hellojukay@gmail.com
> Created Time: 2014年11月22日 星期六 12时07分00秒
************************************************************************/
#include<stdio.h>
int main()
{
char ch;
printf("Please input a character:\n");
scanf("%c",&ch);
while(ch != '\n')
{
printf("The ASCII of %c is %d\n",ch,ch);
scanf("%c",&ch);
}
return 0;
}