Okay so I figured out how to get time in c++ but after that I dont know how to countdown to the desired time that the user set and maybe say "the alarm has gone off" ..I dont know where to go from here:
#include <iostream>
#include <ctime>
#include <iomanip>
usingnamespace std;
char dateStr [9];
char timeStr [9];
char almtimestr[9];
int main(){
_strtime( timeStr);
_strtime( almtimestr);
int consoleWidth=70;
cout<<setw(consoleWidth / 2)<<" "<<"The current time is: "<<timeStr<<endl;
cout<<setw(consoleWidth / 2)<<" "<<endl;
cout<<setw(consoleWidth / 2)<<" "<<"Pls format time as utc"<<endl;
cin >> almtimestr;
//after this I have no idea how to countdown to the desired time say 3:00 pm!!
}
How to check if the time is up or do I count down I have no clue!!
I just needed some instructions and Imma right but can someone pls give me an example of this timing thing !! PLSS I am desperate right now and this is due for tomorow!
There are sleep functions available everywhere. Find one, and make your program sleep for a minute. You may use a while loop, but that's bad because it keeps your processor busy all the time.