#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
bool isLeap(int year){
    return(year % 4 == 0 && year % 100!= 0)||(year % 400 == 0);
}
void calculateDate(int day, int month,int year,const std::steing&operation,int days_to_add){
    std::vector<int>daysinMonth={0,31,28,31,30,31,30,31,30,31,30,31,30,31};
    if(isLeap(year)){
        daysInMonth={daysInMonth[2]=29;
    }
    if(day<1 || month<1 || month >12 ||year<1||day>daysInMonth[month]||(operation!="add"&&operation!="subtract") ){
        cout<<"invalid input"<<endl;
        return;
    }
    if(operation=="add"){
        day+=days_to_add;
        while(day>daysInMonth[month]){
            day-=daysInMonth[month];
            month++;
            if(month>12){
                month=1;
                year++;
            }
            if(isLeap(year)){
                daysInMonth[2]=29;
            }
            else{
                daysInMonth[2]=28;
            }
            day+=daysInMonth[month];
        }
    }
    std::cout<<sta::selfill('0')<<std::setw(2)<<day<<"/"<<std::setfill('0')<<std::setw(2)<<month<<"/"<<year<<std::endl;
        
    }
    int main(){
        int day,month,year,days_to_add;
        std::string operation;
        days=15;
        month=8;
        year=2023;
        operation="add";
        days_to_add=10;
        calcualateDate(day,month,year,operation,days_to_add);
        return 0;
    }