//--------------------------------------------------------------------------- //Jane Jakeman/31/12/05/A2T1TelephoneBox/Ass 2:Task 1 #pragma hdrstop #pragma argsused #include #include #include #include void delaytwo(int); //edited time function void delaytwo(int secs) { int remaining,LastVal; time_t start; //set up start and now to accept time values time_t now; start = time(NULL); //start holds No of seconds since 1st Jan 1970 do{ LastVal=remaining; // prevents printing every time loop now=time(NULL); // now holds the latest no of secs since 1 Jan 1970 remaining=secs-(now-start); //No of secs of delay left gotoxy(5,5); //format if(LastVal!=remaining) cout<<"Connecting...pls wait"<>(a[b]); //input coins to array c=(a[b]+c); //as coins are input, c = array added }while(a[b]!=0); //end condition gotoxy(35,15); //format cout<<"sum total is "<>number[25]; //to hold number clrscr(); //clear screen gotoxy(5,5); //format cout<<"Now dialling"; //Output now dialling { //call function 'delaytwo' delaytwo(5); //with delay set to 5 secs } //end of function 'delaytwo' gotoxy(5,2); //format cout<<"Now connected"; //output at end of 10 sec delay t=0; //set t to 0 to clear memory if (ans=='L') //ans is result of switch t=(c/10)*20; //calculation, pence input, divide by 10 to get 10p unit if (ans=='T') //and then multiply by seconds allowed per choice. t=(c/10)*10; if (ans=='I') t=(c/10)*4; { delay(t); //Set delay ('t' is integer to hold actual time allowance) } gotoxy(5,2); cout<<"Now disconnected"; getchar(); }