Tuesday, June 28, 2011

Calender program in C++

#include
using namespace std;
#include "stdlib.h"
void main ()

{
int year=1;
int yearstart=0;
int century=0;
int monthstart=0;
int endofweek=0;
int monthdays[]= {31,28,31,30,31,30,31,31,30,31,30,31};
int dayon[]= {1,1,1,1,1,1,1,1,1,1,1,1};
int month;
int currentyear;
int currentmonth;
int daysincalendaryearpriortocalendarmonth;
int daysinwholeyearssince1800;
int totalnumdays;
int daysinmonth;
int numblankdays=0;
int day;
int start;
int startday;


cout<<"Enter a year between 1800 & 2100 for the calendar you wish to produce"<>year;

if (year<1800 || year>2100)
cout<<"not a valid year"<>month;

if (month<0 || month>12)
cout<<"not a valid month"<
if (month ==1)
cout<<" january,"<<" "< if (month ==2)
cout<<" february,"<<" "< if (month ==3)
cout<<" march,"<<" "< if (month ==4)
cout<<" april,"<<" "< if (month ==5)
cout<<" may,"<<" "< if (month ==6)
cout<<" june,"<<" "< if (month ==7)
cout<<" july,"<<" "< if (month ==8)
cout<<" august,"<<" "< if (month ==9)
cout<<" september,"<<" "< if (month ==10)
cout<<" october,"<<" "< if (month ==11)
cout<<" november,"<<" "< if (month ==12)
cout<<" december,"<<" "<
cout<<"Sun"<<" "<<"Mon"<<" "<<"Tue"<<" "<<"Wed"<<" "<<"Thu"<<" "<<"Fri"<<" "<<"Sat"<
if (month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12)
daysinmonth=31;

if (month==4 || month==6 || month==9 || month==11)
daysinmonth=30;

if (month==2 & ((year % 400==0) || (year %4==0 && year % 100 !=0)))
daysinmonth=29;

if (month==2 & ((year % 400!=0) || (year %4!=0 && year % 100 ==0)))
daysinmonth=28;

//find start day

// steps 4-7 get total number of days algorithm
//step 4
while (currentyear {
//step 5
if ((year % 400==0) || (year %4==0 && year % 100 !=0))

daysinwholeyearssince1800 += 366;
else
daysinwholeyearssince1800 += 365;

1 comment:

  1. Casino Hotel Reno - MapYRO
    Casino 충주 출장샵 Hotel Reno is a casino hotel located in the South end 부천 출장샵 of the Boulder Highway. 진주 출장샵 The hotel 여주 출장샵 offers 3,000 square feet of gaming space with nearly 청주 출장마사지

    ReplyDelete