SHARE
TWEET

Untitled

a guest Jul 17th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Example program
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5. struct Date
  6. {
  7.     int day;
  8.     int month;
  9.     int year;
  10. };
  11.  
  12. int main()
  13. {
  14.     Date date;
  15.   cout<<"Enter date"<<endl;
  16.   cin>>date.day>>date.month>>date.year;
  17.   date.day=date.day+1;
  18.   switch (date.day){
  19.   case 32: {
  20.   switch (date.month){
  21.   case 1:
  22.   case 3:
  23.   case 5:
  24.   case 7:
  25.   case 8:
  26.   case 10:
  27.   case 12:{
  28.   date.day = date.day -31;
  29.   date.month = date.month + 1;
  30.   }}}
  31.   case 31:{
  32.     switch (date.month){
  33.     case 4:
  34.     case 6:
  35.     case 9:
  36.     case 11:{
  37.     date.day = date.day -30;
  38.   date.month = date.month + 1;
  39.     }
  40.     }
  41.   }
  42.   case 29:{
  43.   if (date.month == 2){
  44.   date.day = date.day -28;
  45.   date.month = date.month + 1;
  46.   }
  47.   }
  48.   }
  49.   if (date.month>12){
  50.       date.month=date.month-12;
  51.       date.year=date.year+1;
  52.   }
  53.       cout<<date.day<<" "<<date.month<<" "<<date.year;
  54.      
  55.   return 0;
  56. }
RAW Paste Data
Top