请编写程序,输入一行字符(用回车键结束)输出每个字符以及与之对应的ascll代码值,每行输出三对
问题描述:
请问一下这题怎么写 思路应该怎么样走?
答
#include <stdio.h>
int main()
{
char c;
int n = 0;
while(scanf("%c",&c)){
if(c == '\n') return 0;
printf("%c:%d ",c,c);
n ++;
if(n % 3 == 0) printf("\n");
}
return 0;
}