This is my code for a digital clock but it only displays the time once when you start the program. Can someone please help me add a loop so it will keep on refreshing until I end the program?
#include <iostream>
#include <ctime>
#include <iomanip>
using namespace std;
int main()
{
_strtime_s( timeStr);
_strtime_s( almtimestr);
int consoleWidth=70;
cout<<setw(consoleWidth / 2)<<" "<<"The current time is: "<<timeStr<<endl;
cout<<setw(consoleWidth / 2)<<" "<<endl;
cin >> almtimestr;
}
//Store the current time in a variable
//display the initial time
while(true) //runs forever because true is always true
{
if(/* current time is different from the time stored in the variable */)
{
//store the new time in the time variable
//display the time variable
}
}