?? du.cpp
字號:
#include <iostream.h>
void main()
{
int a,b,c,d,i,j;
cout<<"please input a number:";
cin>>a;
b=(int)(a/100);
c=a%100;
if(c==0)
{
switch(b)
{
case 1:cout<<"one hunred\n";
break;
case 2:cout<<"two hundred\n";
break;
case 3:cout<<"three hundred\n";
break;
case 4:cout<<"four hundred\n";
break;
case 5:cout<<"five hundred\n";
break;
case 6 :cout<<"six hundred\n";
break;
case 7:cout<<"seven hunderd\n";
break;
case 8:cout<<"eight hundred\n";
break;
case 9:cout<<"nine hundred\n";
break;
}
}
else
{
switch(b)
{
case 1:cout<<"one hundred and ";
break;
case 2:cout<<"two hunderd and ";
break;
case 3:cout<<"three hunderd and ";
break;
case 4:cout<<"four hunderd and ";
break;
case 5:cout<<"five hundred and ";
break;
case 6:cout<<"six hundred and ";
break;
case 7:cout<<" seven hunderd and ";
break;
case 8:cout<<"eight hundred and ";
break;
case 9:cout<<"nine hundred and ";
}
d=(int)(c/10);
switch(d)
{
case 2:cout<<"twenty ";
break;
case 3:cout<<"thirty ";
break;
case 4:cout<<"fouty ";
break;
case 5:cout<<"fifty ";
break;
case 6:cout<<"sixty ";
break;
case 7:cout<<"seventy ";
break;
case 8:cout<<"eighty ";
break;
case 9:cout<<"ninty ";
break;
case 1:switch(c)
{
case 19:cout<<"ninteen\n";
break;
case 18:cout<<"eighteen\n";
break;
case 17:cout<<"sventeen\n";
break;
case 16: cout<<"sixteen\n";
break;
case 15: cout<<"fifteen\n";
break;
case 14: cout<<"fourteen\n";
break;
case 13: cout<<"thirteen\n";
break;
case 12: cout<<"twlen\n";
break;
case 11: cout<<"eleven\n";
break;
case 10: cout<<"ten\n";
break;
}
}
j=a-b*100;
i=j%10;
if(d==1)
goto end;
else
{
switch(i)
{
case 1: cout<<"one\n";
break;
case 2: cout<<"twe\n";
break;
case 3: cout<<"three\n";
break;
case 4:cout<<"four\n";
break;
case 5:cout<<"five\n";
break;
case 6:cout<<"sixa\n";
break;
case 7:cout<<"seven\n";
break;
case 8:cout<<"eight\n";
break;
case 9:cout<<"nine\n";
end:;
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -