Hi, not tested:
// read a number, return it in delta; return TRUE if more to be handled, FALSE when done (with delta=0!)
float getNumber(char* prompt, float* delta) {
float number;
printf(prompt);
scanf("%f", number);
... add whatever checking you consider important
*delta=number;
return number!=0;
}
int main(void) {
float balance, delta;
int more;
printf("BANK RECONCILIATION FOR: 10/21/98");
printf("\n\nEnding balance on statement:");
scanf("%f", &balance);
do {
more=getNumber("Enter Outstanding dep (or 0 to quit)", &delta);
balance+=delta;
while(more);
do {
more=getNumber("Outstanding check/withdrawal (or 0 to quit)");
balance-=delta;
while(more);
printf("Your final balance in your checkbook should be $ %f" , balance);
return 0;
}
:)
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!