Program that show Days of the Month of any year.

Program is taken from the book  C++ IT series Chapter.no.5,Program .no.15
 Program that input month and year from user.And Display number or days in the month of the year entered by user. For example:if user enter 2010 in year and 3 in month it display'March 2010 has 31 days'.

using namespace std;
#include<iostream>
#include<conio.h>
#include<cmath>
int main()
{
  int month,year;
  cout<<"Enter Month:";
  cin>>month;
  cout<<"Which Year:";
  cin>>year;
  switch(month)
  {
  case 1:
  cout<<"January "<<year<<" has 30 days";
  break;
case 2:
     {
      if(year%4==0)
      cout<<"Febrary "<<year<<" has 28 days";
else
cout<<"Febrary "<<year<<" has 29 days";  
 }
break;
case 3:
  cout<<"March "<<year<<" has 31 days";
  break;
  case 4:
  cout<<"April "<<year<<" has 30 days";
  break;
  case 5:
  cout<<"May "<<year<<" has 31 days";
  break;
  case 6:
  cout<<"June "<<year<<" has 30 days";
  break;
  case 7:
  cout<<"July "<<year<<" has 31 days";
  break;
  case 8:
  cout<<"August "<<year<<" has 31 days";
  break;
  case 9:
  cout<<"September "<<year<<" has 30 days";
  break;
  case 10:
  cout<<"October "<<year<<" has 31 days";
  break;
  case 11:
  cout<<"November "<<year<<" has 30 days";
  break;
  case 12:
  cout<<"December "<<year<<" has 31 days";
  break;
        }
  getch();
       return 0;
}

By making little changes in this program we can also use it for:

  • islamic calendar
  • hijri calendar
  • arabic calendar
  • gregorian calendar
  • hijri to gregorian
  • urdu calendar

we also make aprogram as:

  • islamic calendar converter
  • islamic date converter
  • hijri converter
Program that show Days of the Month of any year. Program that show Days of the Month of any year. Reviewed by Shoaib Jameel on 3/08/2017 06:11:00 pm Rating: 5

No comments:

Advertisment

Theme images by mariusFM77. Powered by Blogger.