當前位置:編程學習大全網 - 編程軟體 - 首次編程

首次編程

/*試試這個,不過僅限於妳說的三位數整數。如果不是三位數,就需要修復。

改,因為覺得這個程序有點意思,隨便寫了壹個,用VS2005 (D.H)*/

# include & ltstdio.h & gt

void main()

{

char a[10][6]={ " ","壹","二","三","四","五","六","七","八","九" };//百和單位

char b[10][8]={ " "、"十"、"二十"、"三十"、"四十"、"五十"、"六十"、"七十"、"八十"、"九十",};//十個人

char c[10][9]={ "十"、"十壹"、"十二"、"十三"、"十四"、"十五"、"十六"、"森文"、"十八"、"第九" };//特殊十位數

int數;

Printf("請輸入三位數:");

scanf("%d ",& amp號);

int n[3];

int temp = number

for(int I = 0;我& lt3;i++)

{

n[I]= temp % 10;

temp = temp/10;

}

if(n[1]==0)

if(n[0]!=0)

printf("%s百和% s . % n ",a[n[2]],a[n[0]]);

其他

printf("%s百。\n ",a[n[2]]);

else if(n[1]==1)

printf("%s百和% s . % n ",a[n[2]],c[n[0]]);

其他

printf("%s百和%s %s.\n ",a[n[2]],b[n[1]],a[n[0]]);

}

  • 上一篇:編程
  • 下一篇:運動控制器與PLC有什麽區別
  • copyright 2024編程學習大全網