C++ checkbook - Bahasa C++ ini dibuat menjadi program yang dinamakan CHECKBOOK SOLVER. digunakan untuk menyeimbangkan buku cek kamu.
Listing Code:
#include <stdio.h>
#define TRUE 1
main()
{
float inputValue = 0.;
float checksOutstanding = 0.;
float depositsOutstanding = 0.;
float statementBalance;
float checkbookBalance;
float trialBalance;
/* Enter and accumulate outstanding checks */
printf("\t\t CHECKBOOK SOLVER VERSION 1.0");
printf("\n\n");
printf("\t Created By: Jake Rodriguez Pomperada, MAED-IT ");
printf("\n\n");
do
{
printf( "Enter an outstanding check amount (zero when done): " );
scanf( "%f", &inputValue );
if ( inputValue < 0. )
{
continue;
}
else if ( inputValue < .009 )
{
break;
}
checksOutstanding += inputValue;
} while ( TRUE );
/* Enter and accumulate outstanding deposits */
do
{
printf( "Enter an outstanding deposit (zero when done): " );
scanf( "%f", &inputValue );
if ( inputValue < 0. )
{
continue;
}
else if ( inputValue < .009 )
{
break;
}
depositsOutstanding += inputValue;
} while ( TRUE );
/* Enter the checkbook balance */
printf( "Enter your latest checkbook balance: " );
scanf( "%f", &checkbookBalance );
/* Enter the statement balance */
printf( "Enter the statement balance: " );
scanf( "%f", &statementBalance );
trialBalance = checkbookBalance + checksOutstanding - depositsOutstanding;
if ( trialBalance == statementBalance )
{
printf( "Congratulations, your checkbook balances!\n" );
}
else
{
printf( "Sorry, your balance is different from the bank's by %.2f.\n",
statementBalance - trialBalance );
}
}
Home
»
Source Code
»
C++ checkbook