新微赢技术网
标题:
各位大侠帮我看看这段程序哪里错了
[打印本页]
作者:
枫之泪-天涯
时间:
2009-11-3 04:17
标题:
各位大侠帮我看看这段程序哪里错了
#include<stdio.h>
#include<windows.h>
int main()
{
float principal,rate,interest;
int days;
printf("enter loan principal (-1 to end):");
scanf("%f",&principal);
while(principal!=-1)
{printf("enter interest rate:");
scanf("%f",&rate);
printf("enter term of the loan in days:");
scanf("%f",&days);
interest=(float)principal*rate*days/365;
printf("the interest charge is:$%.2f\n",interest);
printf("enter loan principal (-1 to end):");
scanf("%f",&principal);}
system("pause");
return 0;}
不管输入什么数怎么输出都是31124214.00呀
作者:
丑剑客
时间:
2009-11-3 04:17
程序代码:
#include<stdio.h>
#include<stdlib.h>
int main()
{
float principal,rate,interest;
int days;
printf("enter loan principal (-1 to end):");
scanf("%f",&principal);
while(principal!=-1)
{
printf("enter interest rate:");
scanf("%f",&rate);
printf("enter term of the loan in days:");
scanf("%d",&days); //这行
interest=(float)principal*rate*days/365;
printf("the interest charge is:$%.2f\n",interest);
printf("enter loan principal (-1 to end):");
scanf("%f",&principal);
}
system("pause");
return 0;
}
作者:
亾莣乁靈柩
时间:
2009-11-3 04:17
3Q3Q3Q3Q3Q3Q3Q3Q
欢迎光临 新微赢技术网 (http://bbs.weiying.cn/)
Powered by Discuz! X3.2