44问答网
所有问题
输入一个字符串,输出该字符对应的ascii值
输入一个字符串,输出该字符对应的ascii值
举报该问题
推荐答案 推荐于2017-07-30
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char rec_buf[200];
int i,len;
printf("请输入字符串:");
scanf("%s",rec_buf);
len = strlen(rec_buf);
printf("字符串对应ASCII值(10进制):");
for(i=0;i<len;i++)
printf("%d ",rec_buf[i]);
return 0;
}
温馨提示:答案为网友推荐,仅供参考
当前网址:
http://44.wendadaohang.com/zd/GYYK33WK3YG3K3G6YKR.html
其他回答
第1个回答 2015-08-31
wait "输入一个字符串:" to a
?asc(a)
第2个回答 2015-08-31
#include "stdio.h"
main(){
void ascii(char *p);
char a[20];
gets(a);
char *p;
p=a;
ascii(p);
}
void ascii(char *p){
while(*p!='\0'){
printf("%c ascii is %d\n",*p,*p++);
}
}
本回答被网友采纳
相似回答
大家正在搜
相关问题
输入一个字符,按格式输出这个字符及它的ASCII码
c语言题:编程实现输入一个字符,输出这个字符的ASCII码
描述 输入一个ASCII码,输出对应的字符。 C++代码