⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 balance2.c

📁 The art and science of c_source code!
💻 C
字号:
/* * File: balance2.c * ---------------- * This file contains a buggy second attempt at a program to * balance a checkbook. */#include <stdio.h>#include "genlib.h"#include "simpio.h"main(){    double entry, balance;    printf("This program helps you balance your checkbook.\n");    printf("Enter each check and deposit during the month.\n");    printf("To indicate a check, use a minus sign.\n");    printf("Signal the end of the month with a 0 value.\n");    printf("Enter the initial balance: ");    balance = GetReal();    while (TRUE) {        printf("Enter check (-) or deposit: ");        entry = GetReal();        if (entry == 0) break;        balance += entry;        if (balance < 0) {            printf("This check bounces.  $10 fee deducted.\n");            balance -= 10;        }        printf("Current balance = %g\n", balance);    }    printf("Final balance = %g\n", balance);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -