用C语言写下面一个程序,最好用Switch语句write a program that tasks an intger keyd in from the terminal and extracts and extracts and displays each digit of the integer int English.So,if the user types int 932,the program should display.

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/05 23:19:16
用C语言写下面一个程序,最好用Switch语句write a program that tasks an intger keyd in from the terminal and extracts and extracts and displays each digit of the integer int English.So,if the user types int 932,the program should display.
xTn@]?FBR)Wqݲ{ǧ) ,( "RT$Q +~NZAK9܇Nm,L-ϖӡd>q>gӑ1.D0l Ǔ\F-;@PyH&B Qߔh@@ :ct 4阘saKV Q(--xL,sOXz\x)HnSYWM]6x&*&w#t.LL+vD_.>]c9nqb9} ]M+,bTxm}LGC- ɉy\UA*LJJŧ3h\voM`[e)A;t˗}wf(_-\;/l>6Q\lK`/[?^ $4Pvpuq[сR9QOpM.ٯ里Ww)qDcT\p *鋦V٪UWGgcXϠqFO[

用C语言写下面一个程序,最好用Switch语句write a program that tasks an intger keyd in from the terminal and extracts and extracts and displays each digit of the integer int English.So,if the user types int 932,the program should display.
用C语言写下面一个程序,最好用Switch语句
write a program that tasks an intger keyd in from the terminal and extracts and extracts and displays each digit of the integer int English.So,if the user types int 932,the program should display.

用C语言写下面一个程序,最好用Switch语句write a program that tasks an intger keyd in from the terminal and extracts and extracts and displays each digit of the integer int English.So,if the user types int 932,the program should display.
#include <stdio.h>

//显示每个数字的英文
void displayEnglish(int num)
{
switch(num)
{
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;
default:
printf("error.\n");
}
}

void main()
{
printf("输入一个整数:");
int num;
scanf("%d",&num);

do
{
displayEnglish(num%10);
num/=10;
} while(num>0);
printf("\n");
}