C语言编好的程序一闪而过,怎么不一闪而过? 已经加了# include<stdlib.h>和system(“pause”);
我是初学者,麻烦知道的提醒一下啊!#include<stdio.h>#include<math.h>#include<bios.h>#include<conio.h>#i...
我是初学者,麻烦知道的提醒一下啊!
# 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;
}
麻烦知道的人,帮我运行一下啊,然后告诉我为什么啊?谢谢啊! 展开
# 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;
}
麻烦知道的人,帮我运行一下啊,然后告诉我为什么啊?谢谢啊! 展开
展开全部
一闪而过就是错了。
# include <stdio.h>
# include <math.h>
# include <conio.h>
# include <stdlib.h>
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的问题,但不知如何解决!!!!
# include <stdio.h>
# include <math.h>
# include <conio.h>
# include <stdlib.h>
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的问题,但不知如何解决!!!!
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
在return之前,用getchar();
追问
还是不行耶 选择数字后 ,然后提示输入存款金额,输入之后,就一闪没了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2012-05-17
展开全部
按Ctrl+F5运行试试。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
把money变量改成float型呢?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询