Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Example program
- #include <iostream>
- #include <string>
- using namespace std;
- struct Date
- {
- int day;
- int month;
- int year;
- };
- int main()
- {
- Date date;
- cout<<"Enter date"<<endl;
- cin>>date.day>>date.month>>date.year;
- date.day=date.day+1;
- switch (date.day){
- case 32: {
- switch (date.month){
- case 1:
- case 3:
- case 5:
- case 7:
- case 8:
- case 10:
- case 12:{
- date.day = date.day -31;
- date.month = date.month + 1;
- }}}
- case 31:{
- switch (date.month){
- case 4:
- case 6:
- case 9:
- case 11:{
- date.day = date.day -30;
- date.month = date.month + 1;
- }
- }
- }
- case 29:{
- if (date.month == 2){
- date.day = date.day -28;
- date.month = date.month + 1;
- }
- }
- }
- if (date.month>12){
- date.month=date.month-12;
- date.year=date.year+1;
- }
- cout<<date.day<<" "<<date.month<<" "<<date.year;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement