首先打开VC++文件》》》新建
创建一个C++空白文档先声明头文件#include
声明变量char *p[10]={"零","一","二","三","四","五","六","七","八","九"}
由于用到了自定义函数,所以先声明void PrintInterger(char a[], int len)/*输出整数部分 */void PrintDecimal(char a[],int len)/*输出小数部分 */
函数1,用于输出整数部分,主要是用switch case进行匹配转换void PrintInterger(char a[], int len)。
#include<math.h>#include<stdio.h>
main(){
int a,c,d,e
float b=10000
int f
int num=1
printf("\t\t\t CHNIA BANK ATM\nplease input your secret code:\n")
scanf("%d",&a)
if(a==num){
printf(" welcome you to use your count,you have %.2f RMB!\n",b)
printf(" how much money do you want? please input the numbers: ")
scanf("%d",&e)
printf("\n")
c=b-e
printf(" you till have : %d ,please choose exit or choose function ! \n",c)
scanf("%c",&d)
printf("\n")
}
else if(a!=num){
printf("your secret code is wrong,please input the correct secret code!\n")
}
printf("\t\t \tHELLO,WELCOME TO USE ATM\nplease choose you want function\n")
printf("\n\n")
printf("\t\t-----------------------------------\n")
printf("\t\t|\t\t|\t\t |\n")
printf("\t\t| 1. check\t| 2. withdraw money\t |\n")
printf("\t\t|\t\t|\t\t |\n")
printf("\t\t-----------------------------------\n")
printf("\t\t|\t\t|\t\t |\n")
printf("\t\t| 3. transfer account\t| 4. midify secret code|\n")
printf("\t\t|\t\t|\t\t |\n")
printf("\t\t-----------------------------------\n")
printf("\t\t|\t\t\t\t |\n")
printf("\t\t|\t 0. exit \t\t |\n")
printf("\t\t|\t\t\t\t |\n")
printf("\t\t-----------------------------------\n")
printf("please choose function:\n ")
scanf("%d",&f)
switch(f)
{ case 0:printf("exit")break
case 1:printf("check")break
case 2:printf("withdraw money")break
case 3:printf("transfer account")break
case 4:printf("midify secret code")break
default :printf("it's wrong,please choose in 0~4!")
}
getch()
}