hi
my program is a tollbooth my program is working i just want to know if want to terminate my program using ESCAPE key what should i as it is a funtion key
here is my code
here i have used '@' key to get out from loopCode:# include <iostream> # include <conio.h> using namespace std; class tollbooth { private: long int total_cars; float total_cash; public: void payingcar()//inline function { total_cars++; total_cash=total_cash+0.50; }//end of function void nonpayingcar()//inline function { total_cars++; }//end function void print () //inline function { cout<<"total cars passed:"<<total_cars<<endl; cout<<"total cash received:"<<total_cash<<endl; }//end function tollbooth () { total_cars=0; total_cash=0; }//end constructor };//end class int main () { tollbooth lahore; char push_key; cin>>push_key; do { if (push_key=='1') { lahore.payingcar(); }//end if if (push_key=='0') { lahore.nonpayingcar(); }//end else cin>>push_key; }//end do while (push_key!='@'); lahore.print (); getch (); }//end main



LinkBack URL
About LinkBacks


