Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include <iomanip>
#include <iostream>
#include <stdlib.h>
#include <Windows.h>
using namespace std;
class timer
{
int hours = 0;
int minutes = 0;
int seconds = 0;
// function to display the timer
void CounterClock()
{
// system call to clear the screen
system("cls");
cout << setfill(' ') << setw(26) << " COUNTERCLOCK \n";
cout << setfill(' ') << setw(26) << " ..........................\n";
cout << setfill(' ') << setw(19);
cout << "| " << setfill('0') << setw(2) << hours << " hrs | ";
cout << setfill('0') << setw(2) << minutes << " min | ";
cout << setfill('0') << setw(2) << seconds << " sec |" << endl;
cout << setfill(' ') << setw(26) << " ...........................\n";
}
void countdown()
{
while (true) {
CounterClock();
Sleep(1);
seconds++;
if (seconds == 60) {
minutes++;
if (minutes == 60) {
hours++;
minutes = 0;
}
seconds = 0;
}
}
}
};