Answer to Question #315506 in UNIX/Linux Programming for Attique

Question #315506

Develop a stopwatch with lap counter and total time calculator. The program will create two processes and they will start calculating time. One process will be used to calculate total time and the other will calculate lap time. The total time calculator process will keep on calculating time. In the lap time, calculator process when it reaches lap time limit, the process will display lap number and set its counter to zero and start calculating again. Take input of lap time and number of laps from the user and start the program. At the end, display total time from total time calculator process.


1
Expert's answer
2022-03-22T09:06:59-0400
int main()
{
	int sec=0;
	int min=0;
	int hour=0;
	for (int i = 0; i < 99999999; i++)
	{
		sec++;
		cout << hour << ":" << min << ":" << sec << endl;
		if(sec == 60)
		{
			min++;
			sec = 0;
		}
		else if(min == 60)
		{
			hour++;
			min = 0;
		}
		Sleep(1000);
		system("cls");


	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS