Program to find the total days in the year till date

Program to find the total days in the year till date
#include <iostream>
using namespace std;
int main(){
       int day, month, total;
       cout << "Enter the month" << endl;
       cin >> month;
       cout << "Enter the day" << endl;
       cin >> day;
       total = 0;
       int day_per_month[12] = { 31, 28, 31, 30, 31, 31, 30, 31, 30, 31, 30, 31 };
       int a;
       for (int i = 0; i < month - 1; i++){
             
              total= day_per_month[i]+total;
       }
       cout << "The number of days in this years till date = " << total+day << endl;
       system("pause");
       return 0;

}

Comments