Advertisement
Guest User

ReminderAPP

a guest
Sep 11th, 2016
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.93 KB | None | 0 0
  1. #include "Functions.h"
  2. #include <iostream>
  3. #include <string>
  4. #include <Windows.h>
  5. #include <time.h>
  6.  
  7.  
  8. void Functions::printFunctions()
  9. {
  10.     cout<<"1.Set reminder."<<endl;
  11.     cout<<"2.Delete reminder."<<endl;
  12.     cout<<"3.View reminder history."<<endl;
  13. }
  14.  
  15. void Functions::showClock()
  16. {
  17.     time_t currentTime;
  18.     time(&currentTime); //Calling the function
  19.      
  20.     ctime(&currentTime); //convert to string
  21.  
  22.     cout << ctime(&currentTime);
  23.    
  24.     struct tm *myTime = localtime(&currentTime);
  25. }
  26.  
  27. void Functions::setReminder()
  28. {
  29.     string strexit;
  30.     while(strexit != "x" && "X")
  31.     {
  32.    
  33.     unsigned long long days = 0;
  34.     unsigned long hours = 0;
  35.     unsigned long minutes = 0;
  36.     unsigned long seconds = 0;
  37.  
  38.     cout <<"How much days from now should be added?"<<endl;
  39.  
  40.     cin >> days;
  41.  
  42.     if(days >0)
  43.     {
  44.         cout << days <<" Days have been added!"<<endl;
  45.     }
  46.     else
  47.     {
  48.         cout <<"Days skipped!"<<endl;
  49.     }
  50.    
  51.     cout <<"----------------------"<<endl;
  52.  
  53.     cout <<"How much hours from now should be added?"<<endl;
  54.    
  55.     cin >> hours;
  56.  
  57.     if(hours >0)
  58.     {
  59.         cout << hours <<" Hours have been added!"<<endl;
  60.     }
  61.     else
  62.     {
  63.         cout <<"Hours skipped!"<<endl;
  64.     }
  65.  
  66.     cout <<"----------------------"<<endl;
  67.  
  68.     cout <<"How much minutes from now should be added?"<<endl;
  69.    
  70.     cin >> minutes;
  71.  
  72.     if(minutes >0)
  73.     {
  74.         cout << minutes <<" Minutes have been added!"<<endl;
  75.     }
  76.     else
  77.     {
  78.         cout <<"Minutes skipped!"<<endl;
  79.     }
  80.  
  81.     cout <<"----------------------"<<endl;
  82.  
  83.     cout <<"How much seconds from now should be added?"<<endl;
  84.    
  85.     cin >> seconds;
  86.  
  87.     if(seconds >0)
  88.     {
  89.         cout << seconds <<" Seconds have been added!"<<endl;
  90.     }
  91.     else
  92.     {
  93.         cout <<"Seconds skipped!"<<endl;
  94.     }
  95.    
  96.     days = days * 86400000;
  97.     hours = hours * 3600000;
  98.     minutes = minutes * 60000;
  99.     seconds = seconds * 1000;
  100.  
  101.     Sleep(days+hours+minutes+seconds);
  102.  
  103.     cout <<"Enter . to exit or n to add another reminder"<<endl;
  104.     cin >> strexit;
  105.  
  106.     if(strexit == "n" && "N")
  107.     {
  108.         break;
  109.     }
  110.  
  111. }
  112.  
  113.    
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement