/*********************************************************************\ PROGRAM: account.cpp PURPOSE: to accumulate the total of credit and debit transactions AUTHOR: Tony Jinman DATE WRITTEN: 11/05/00 LAST UPDATE: 11/05/00 \*********************************************************************/ #include #include #include //define function macros #define g(x,y) gotoxy(x,y) #define JL setiosflags(ios::left) #define JR setiosflags(ios::right) void main() {//start of function main float credits=0,debits=0,amount=0; char response; cout<'Y') response-=32;//convert to upper case if(response!='Y'&&response!='N')//invalid key pressed cout<<"\a\b"; }while(response!='Y'&&response!='N');//end of do loop g(31,10); cout<<" "; //start main loop while(response!='N') {//start of main while loop g(1,5); cout<<"Enter transaction amount: £"; g(27,5); cout<<" "; g(27,5); cin>>amount; //evaluate amount if(amount>=0) {//start of if credits+=amount; g(45,cRow++);//increase credit row count cout<<"£"<'Y') response-=32;//convert to upper case if(response!='Y'&&response!='N')//invalid key pressed cout<<"\a\b"; }while(response!='Y'&&response!='N');//end of do loop g(27,10); cout<<" "; }//end of main while loop clrscr(); g(31,10); cout<<"PROGRAM TERMINATED"; }//end of function main