Advertisement
Guest User

Untitled

a guest
Jan 26th, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #include  <iostream>
  2. #include  <string>
  3. using namespace std;
  4.  
  5. struct time {
  6.     string meridiem;   // AM or PM
  7.     int hour;
  8.     int minute;
  9.     int seconds;
  10.    
  11.  
  12. };
  13. void sleeptime(time &t,int sleepAmount) {
  14.     t.hour += sleepAmount;
  15. }
  16.  
  17. void blackBox (time &t, int magicNumber){
  18.     t.hour += magicNumber;
  19.     t.minute -= magicNumber;
  20. }
  21. int main() {
  22.     time t1;
  23.     t1.meridiem = "AM";
  24.     t1.hour = 9;
  25.     t1.minute = 33;
  26.     t1.seconds = 54;
  27.     //cout << t1.hour << " : " << t1.minute << "." << t1.seconds << "  " << t1.meridiem << endl;
  28.    
  29.     time t2;
  30.     t2.meridiem = "PM";
  31.     t2.hour = 11;
  32.     t2.minute = 20;
  33.     t2.seconds = 47;
  34.     //cout << t2.hour << " : " << t2.minute << "." << t2.seconds << "  " << t2.meridiem << endl;
  35.  
  36.     cout << "If you go to sleep at:" << cout << t2.hour << "  " << t2.meridiem << endl;
  37.     sleeptime(t2, 9);
  38.     cout << "You should wake up at:" << cout << t2.hour <<  "  " << t2.meridiem << endl;
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement