Hi,
i am creating a washing machine program and when you select a command for example "wash" it will wash. what i want it to do is when wash is selected cout down to zero and then return to the main screen.
i have the code for the coutdown but i am unsure how to implement it into an if statement.
here is the timer code.
Code:void wait ( int seconds ) { clock_t endwait; endwait = clock () + seconds * CLK_TCK ; while (clock() < endwait) {} } int main2 () { int n; cout << "Washing...\n"; for (n=10; n>0; n--) { printf ("%d\n",n); wait (1); } cout << "WASHING COMPLETE\n"; }
i would like this code to activate for example at this part of the program.
Code:if (number==1) { system("cls"); cout <<"WASHING" <<endl <<endl; }
Can anyone help how to get it to work?



LinkBack URL
About LinkBacks


