编写程序,从键盘输入一个数字0-9,输出对应的英文单词如从键盘输入1,程序输出one
展开全部
char str[20][6] = {
"0", "zero",
"1", "one",
"2", "two",
"3", "three",
"4", "four",
"5", "five",
"6", "six",
"7", "seven",
"8", "eight",
"9", "nine" };
char buf[256] = { 0 };
gets(buf);
for (int i = 0; i < 20; i+=2)
{
if (*buf == str[i][0])
{
for (int j=0; j < 6; j++)
{
printf("%c", str[i+1][j]);
}
//break;
}
}
getchar();
展开全部
#include <stdio.h>
int main()
{
int number;
scanf("%d",&number);
putchar('\n');
switch(number)
{
case 0: printf("zero"); break;
case 1: printf("one"); break;
case 2: printf("two"); break;
case 3: printf("there"); break;
case 4: printf("four"); break;
case 5: printf("five"); break;
case 6: printf("six"); break;
case 7: printf("seven"); break;
case 8: printf("eight"); break;
case 9: printf("nine"); break;
default: break;
}
putchar('\n');
return 0;
}
int main()
{
int number;
scanf("%d",&number);
putchar('\n');
switch(number)
{
case 0: printf("zero"); break;
case 1: printf("one"); break;
case 2: printf("two"); break;
case 3: printf("there"); break;
case 4: printf("four"); break;
case 5: printf("five"); break;
case 6: printf("six"); break;
case 7: printf("seven"); break;
case 8: printf("eight"); break;
case 9: printf("nine"); break;
default: break;
}
putchar('\n');
return 0;
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#include <stdio.h>
int main()
{
int Input;
scanf("%d",&Input);
switch(Input)
{
case 0:printf("zero"); break;
case 1:printf("one"); break;
case 2:printf("two"); break;
case 3:printf("three"); break;
case 4:printf("four"); break;
case 5:printf("five"); break;
case 6:printf("six"); break;
case 7:printf("seven"); break;
case 8:printf("eight"); break;
case 9:printf("nine"); break;
}
return 0;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐于2017-06-13
展开全部
#include <stdio.h>
void main()
{
int num = 0;
while(1)
{
printf("请输入数字 0 - 9\n");
scanf("%d", &num);
switch(num)
{
case 0:
printf("zero\n");
break;
case 1:
printf("one\n");
break;
case 2:
printf("two\n");
break;
case 3:
printf("three\n");
break;
case 4:
printf("four\n");
break;
case 5:
printf("five\n");
break;
case 6:
printf("six\n");
break;
case 7:
printf("seven\n");
break;
case 8:
printf("eight\n");
break;
case 9:
printf("nine\n");
break;
default:
printf("超出范围\n");
break;
}
}
}
void main()
{
int num = 0;
while(1)
{
printf("请输入数字 0 - 9\n");
scanf("%d", &num);
switch(num)
{
case 0:
printf("zero\n");
break;
case 1:
printf("one\n");
break;
case 2:
printf("two\n");
break;
case 3:
printf("three\n");
break;
case 4:
printf("four\n");
break;
case 5:
printf("five\n");
break;
case 6:
printf("six\n");
break;
case 7:
printf("seven\n");
break;
case 8:
printf("eight\n");
break;
case 9:
printf("nine\n");
break;
default:
printf("超出范围\n");
break;
}
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询