我是初学者,麻烦知道的提醒一下啊!
# include <stdio.h>
# include <math.h>
# include <bios.h>
# include <conio.h>
# include <stdlib.h>
int main(void)
{
int choice,money;
float sum;
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:{
float one_year(float money);
printf("Please input the amount of deposit :");
scanf("%f",&money);
sum=one_year(money);
break;
}
case 2:{
float two_year(float money);
printf("Please input the amount of deposit :");
scanf("%f",&money);
sum=two_year(money);
break;
}
case 3:{
float three_year(float money);
printf("Please input the amount of deposit :");
scanf("%f",&money);
sum=three_year(money);
break;
}
case 4:{
float five_year(float money);
printf("Please input the amount of deposit :");
scanf("%f",&money);
sum=five_year(money);
break;
}
case 5:{
float eight_year(float money);
printf("Please input the amount of deposit :");
scanf("%f",&money);
sum=eight_year(money);
break;
}
case 0:break;
}
}while(choice!=0);
printf("%.3f",sum);
system("pause");
return 0;
}
float one_year(float money)
{
float sum,i,a;
a=1;
for(i=0;i<=12;i++){
a=a*1.0225;
}
sum=a*money;
return sum;
}
float two_year(float money)
{
float sum,a,i;
a=1;
for(i=0;i<=12;i++){
a=a*1.0243;
}
sum=a*money;
return sum;
}
float three_year(float money)
{
float sum,a,i;
a=1;
for(i=0;i<=12;i++){
a=a*1.0270;
}
sum=a*money;
return sum;
}
float five_year(float money)
{
float sum,a,i;
a=1;
for(i=0;i<=12;i++){
a=a*1.0288;
}
sum=a*money;
return sum;
}
float eight_year(float money)
{
float sum,a,i;
a=1;
for(i=0;i<=12;i++){
a=a*1.03;
}
sum=a*money;
return sum;
}
麻烦知道的人,帮我运行一下啊,然后告诉我为什么啊?谢谢啊!
还是不行耶 选择数字后 ,然后提示输入存款金额,输入之后,就一闪没了