c语言 没有system.h,为什么我的c语言前没加#include<stdlib.h>,system("pause")也可以使用...

2012-09-26 回答

一闪而过就是错了。 # include # include # include # include int main(void) { int choice,money; int sum=0; do{ clrscr(); textcolor(red); gotoxy(13,3); printf("\xdb\xdb\xdb\xdb\xb2 interest calculator \xb2\xdb\xdb\xdb\xdb"); gotoxy(2,9); printf("choose year 1:one year; 2:two year; 3:three year"); gotoxy(2,10); printf(" 4: five year; 5: eight year; 0: exit\n"); printf("please choose years deposits : \n"); scanf("%d",&choice); switch(choice) { case 1:{ int one_year(int money); printf("please input the amount of deposit :"); scanf("%d",&money); sum+=one_year(money); break; } case 2:{ int two_year(int money); printf("please input the amount of deposit :"); sleep(6); scanf("%d",&money); sum+=two_year(money); break; } case 3:{ int three_year(int money); printf("please input the amount of deposit :"); sleep(6); scanf("%d",&money); sum+=three_year(money); break; } case 4:{ int five_year(int money); printf("please input the amount of deposit :"); sleep(6); scanf("%d",&money); sum+=five_year(money); break; } case 5:{ int eight_year(int money); printf("please input the amount of deposit :"); sleep(6); scanf("%d",&money); sum+=eight_year(money); break; } case 0:break; } }while(choice!=0); sleep(6); printf("%.3d",sum); system("pause"); return 0; } int one_year(int money) { int sum,i,a; a=1; for(i=0;i<=12;i++){ a=a*1.0225; } sum=a*money; return sum; } int two_year(int money) { int sum,a,i; a=1; for(i=0;i<=12;i++){ a=a*1.0243; } sum=a*money; return sum; } int three_year(int money) { int sum,a,i; a=1; for(i=0;i<=12;i++){ a=a*1.0270; } sum=a*money; return sum; } int five_year(int money) { int sum,a,i; a=1; for(i=0;i<=12;i++){ a=a*1.0288; } sum=a*money; return sum; } int eight_year(int money) { int sum,a,i; a=1; for(i=0;i<=12;i++){ a=a*1.03; } sum=a*money; return sum; } //我看网上的回答,应该是float的问题,但不知如何解决!!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值