In: Computer Science
#include<iostream>
#include<chrono>
#include<thread>
using namespace std;
using namespace std::chrono;
using namespace std::this_thread;
void alarm(){
bool snooze = true;
string s;
while(snooze){
cout << "Its 8'o clock
already" << endl;
cout << "Press f to
snooze..." << endl;
//sleep_until(system_clock::now() + seconds(3));
//uncomment line 16 if you
want to add a delay between alarm messages
if(cin.get() == 'f'){
snooze
= false;
}
}
cout << "Alarm snoozed for 5 mins";
cout << endl;
}
void brushTeeth(){
cout << "I'm brushing my teeth" <<
endl << endl;
sleep_until(system_clock::now() + seconds(3));
// adds a delay of 3 seconds. You can change the value.
cout << "I'm done brushing" << endl
<< endl;
}
void getDressed(){
cout << "I'm dressing up" << endl
<< endl;
sleep_until(system_clock::now() +
seconds(3));
cout << "I'm dressed now" << endl
<< endl;
}
void eatBreakfast(){
cout << "I'm eating my breakfast" <<
endl << endl;
sleep_until(system_clock::now() +
seconds(3));
cout << "I'm done eating" << endl
<< endl;
}
void gotoWork(){
cout << "Going to work!" <<
endl;
exit(0); // triggers program to end
}
int main(){
alarm();
alarm(); // calling twice as mentioned
brushTeeth();
getDressed();
eatBreakfast();
gotoWork();
}