Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Functions.h"
- #include <iostream>
- #include <string>
- #include <Windows.h>
- #include <time.h>
- void Functions::printFunctions()
- {
- cout<<"1.Set reminder."<<endl;
- cout<<"2.Delete reminder."<<endl;
- cout<<"3.View reminder history."<<endl;
- }
- void Functions::showClock()
- {
- time_t currentTime;
- time(¤tTime); //Calling the function
- ctime(¤tTime); //convert to string
- cout << ctime(¤tTime);
- struct tm *myTime = localtime(¤tTime);
- }
- void Functions::setReminder()
- {
- string strexit;
- while(strexit != "x" && "X")
- {
- unsigned long long days = 0;
- unsigned long hours = 0;
- unsigned long minutes = 0;
- unsigned long seconds = 0;
- cout <<"How much days from now should be added?"<<endl;
- cin >> days;
- if(days >0)
- {
- cout << days <<" Days have been added!"<<endl;
- }
- else
- {
- cout <<"Days skipped!"<<endl;
- }
- cout <<"----------------------"<<endl;
- cout <<"How much hours from now should be added?"<<endl;
- cin >> hours;
- if(hours >0)
- {
- cout << hours <<" Hours have been added!"<<endl;
- }
- else
- {
- cout <<"Hours skipped!"<<endl;
- }
- cout <<"----------------------"<<endl;
- cout <<"How much minutes from now should be added?"<<endl;
- cin >> minutes;
- if(minutes >0)
- {
- cout << minutes <<" Minutes have been added!"<<endl;
- }
- else
- {
- cout <<"Minutes skipped!"<<endl;
- }
- cout <<"----------------------"<<endl;
- cout <<"How much seconds from now should be added?"<<endl;
- cin >> seconds;
- if(seconds >0)
- {
- cout << seconds <<" Seconds have been added!"<<endl;
- }
- else
- {
- cout <<"Seconds skipped!"<<endl;
- }
- days = days * 86400000;
- hours = hours * 3600000;
- minutes = minutes * 60000;
- seconds = seconds * 1000;
- Sleep(days+hours+minutes+seconds);
- cout <<"Enter . to exit or n to add another reminder"<<endl;
- cin >> strexit;
- if(strexit == "n" && "N")
- {
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement