-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalendar.cpp
More file actions
81 lines (74 loc) · 1.78 KB
/
Copy pathcalendar.cpp
File metadata and controls
81 lines (74 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include<iostream>
#include <string>
using namespace std;
int main()
{
string days[7] = {"Mon","Tue","Wed","Thu","Fri","Sat","Sun"};
string months [12] = {"January","February","March","April","May","June","July","August","September","October","November","December"};
int date[31], m=1,c=31,d=0;
for (int i=0;i<=31;i++) //for assingning dates
{
date[i]=m;
++m;
}
for (int k=0;k<12;k++) //for printing months
{
cout<<"\t "<<months[k]<<endl<<endl; //for months
for (int i=0;i<7;i++) //for printing days
cout<<days[i]<<" "; //for days
cout<<endl;
if(k==1 || k==3 || k==5 || k==7 || k==9 || k==11) //assingning no. of days to each month
{
if (k==1)
m=28;
else
m=30;
}
else
m=31;
int e=7,a=0,c=28,u=6; //helping variables for space and endl
//for dates
for (int z=0;z<m;z++) //for printingg dates
{
//for entries
if(k>=1 && z<=u)
{
/*if (k==1)
c=28;
else
c=28;*/
while ( d>28 )
{
cout<<" ";
--d;
++a;
--e;
--u;
}
cout<<date[z]<<" ";
if(date[z]/10==0) //z=3,value 4,k==1
cout<<" ";
if(date[z]%(e)==0)
{
c=date[z];
cout<<endl;
e=7;
}
}
else
{
cout<<date[z]<<" ";
if(date[z]/10==0) //for beuty
cout<<" ";
if (z!=0) //for line ending
{
if (date[z-a]%e==0 )
cout<<endl;
}
}
}
d=m;
cout<<endl;
}
return 0;
}