void main()
{
char SelectKey,CreditMoney,DebitMoney
while(1)
{
do{
clrscr()
puts("Please select key:")
puts("1.Quary")
puts("2.Credit")
puts("3.Debit")
puts("4.Return")
SelectKey=getch()
}while(SelectKey!='1'&&SelectKey!='2'&&SelectKey!='3'&&SelectKey!='4')
switch(SelectKey)
{
case'1':
clrscr()
puts("Your balance is $1000")
getch()
break
case'2':
do{
clrscr()
puts("Please select Credit money:")
puts("1.$50")
puts("2.$100")
puts("3.Return")
CreditMoney=getch()
}while(CreditMoney!='1'&&CreditMoney!='2'&&CreditMoney!='3')
switch(CreditMoney)
{
case'1':
clrscr()
puts("Your Credit money is $50,Thank you!")
getch()
break
case'2':
clrscr()
puts("Your Credit money is $100,Thank you!")
getch()
break
case'3':
break
}
break
case'3':
do{
clrscr()
puts("Please select Debit money:")
puts("1.$50")
puts("2.$100")
puts("3.$500")
puts("4.$1000")
puts("5.Return")
DebitMoney=getch()
}while(DebitMoney!='1'&&DebitMoney!='2'&&DebitMoney!='3'&&DebitMoney!='4'&&DebitMoney!='5')
switch(DebitMoney)
{
case'1':
clrscr()
puts("Your Debit money is $50,Thank you!")
getch()
break
case'2':
clrscr()
puts("Your Debit money is $100,Thank you!")
getch()
break
case'3':
clrscr()
puts("Your Debit money is $500,Thank you!")
getch()
break
case'4':
clrscr()
puts("Your Debit money is $1000,Thank you!")
getch()
break
case'5':
break
}
break
case'4':
return
}
}
}
几个小错误而已...比如忘了写双撇号,switch写错了...还有!= 忘了写! 等等.. 以上程序可以运行了
#include <stdio.h>
int main (void)
{
int i,g,q=10000,qq=0,z
char mm[6]
const char MM[6]="123456"
while(1)
{
for(i=0i<6i++)
{
mm[i]=getch()
if (mm[i]!='\b')
{
putchar ('*')
}
else
{
printf ("\b \b")
i--
i--
}
if (mm[i]=='\r')
{
printf ("\b \b")
break
}
}
if (strcmp(mm,MM)==0)
{
printf ("\n\t密码正确!登入银行账户!\n")
printf ("\t[1]查询余额\t[2]取钱\n\t选项:")
scanf ("%d",&g)
switch (g)
{
case 1:printf ("\t你的余额剩余%d元\n",q-qq)break
case 2:printf ("\请输入提取金额:")scanf ("%d",&qq)printf ("\t提取现金%d元\n",qq)break
default:printf ("\t选项错误!\n")break
}
break
}
else
{
printf ("\n密码错误!\n")
printf ("请重新输入密码:")
}
}
}
本来是想来个简单的结果看到楼下说要登入这些功能。。。
这是简单的
#include <stdio.h>int main (void)
{
double a=10000
int i
printf ("请输入你要提取的金额:")
scanf ("%d",&i)
printf ("您的账户余额:%g元",a-i)
return 0
}
再来个稍难得吧。。。
#include <stdio.h>int main (void)
{
char mm[6]
double a=10000
int i=0,g
printf ("[1]取款[2]查询余额:")
scanf ("%d",&g)
switch (g)
{
case 1:printf ("请输入提取金额:")scanf ("%d",&i)printf ("账户余额%g",a-i)break
case 2:printf ("账户余额%g",a-i)break
default:printf ("选项错误!\n")break
}
return 0
}
从编译器复制下来的代码中文都要乱码。。。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)