您的位置:首页 > 其它

第5章例5-8

2013-10-04 09:26 211 查看
#include<stdio.h>
float cash;
int main(void)
{
int choice;
float value;
void income(float number),expend(float number);

cash = 0;
printf("Enter operate choice(0--end,1--income,2--expend):");
scanf("%d",&choice);
while(choice!=0){
if(choice==1||choice==2){
printf("Enter cash value:");
scanf("%f",&value);
if(choice==1)
income(value);
else
expend(value);
printf("current cash:%.2f\n",cash);
}
printf("Enter operate choice(0--end,1--income,2--expend):");
scanf("%d",&choice);
}

return 0;
}

void income(float number)
{
cash=cash + number;
}

void expend(float number)
{
cash=cash-number;
}


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: