├── CALANDER_C_PROJECT ├── README.md └── Calender.c /CALANDER_C_PROJECT: -------------------------------------------------------------------------------- 1 | Calender_C_Project 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CALENDER_C_PROJECT 2 | 3 | 4 | 5 | First Input year number and month number 6 | ![Capture](https://github.com/jahidnub/Individual-project/assets/136675591/873080d5-fc8e-454d-b7ed-50f65e153919) 7 | now the output is 8 | ![Uploading Capture 1.PNG…]() 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Calender.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int getkey(); 6 | void display(int,int,int,int[]); 7 | void calendar(int,int); 8 | void gotoxy(int x,int y) 9 | { 10 | COORD coord; 11 | coord.X=x; 12 | coord.Y=y; 13 | SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord); 14 | } 15 | void SetColor(int ForgC) 16 | { 17 | WORD wColor; 18 | HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); 19 | CONSOLE_SCREEN_BUFFER_INFO csbi; 20 | 21 | if(GetConsoleScreenBufferInfo(hStdOut, &csbi)) 22 | { 23 | wColor = (csbi.wAttributes & 0xF0) + (ForgC & 0x0F); 24 | SetConsoleTextAttribute(hStdOut, wColor); 25 | } 26 | return; 27 | } 28 | 29 | 30 | char *month[]={"January","February","March","April","May","June","July","August","September","October","November","December"}; 31 | char *week[]={"Mon","Tue","Wed","Thu","Fri","Sat","Sun"}; 32 | 33 | int main() 34 | { 35 | int nmonth,nyr,ch; 36 | enteryear: 37 | while(1) 38 | { 39 | printf("\n\t\tENTER YEAR (number) : " ); 40 | scanf("%d",&nyr); 41 | printf("\n\t\tENTER MONTH (number) : " ); 42 | scanf("%d",&nmonth); 43 | if(nyr<1945) 44 | { 45 | printf("\n\t Please enter year above 1945\n"); 46 | continue; 47 | } 48 | else 49 | { 50 | calendar(nyr,nmonth); 51 | } 52 | while(1) 53 | { 54 | gotoxy(20,20);printf("(*) Use LEFT, RIGHT, UP and DOWN arrow."); 55 | gotoxy(20,22);printf("(*) Press P to go to particular year and month."); 56 | gotoxy(20,24);printf("(*) Press ESC to Exit."); 57 | ch=getkey(); 58 | switch(ch) 59 | { 60 | case 80: 61 | if(nmonth==12) 62 | { 63 | nmonth=1; 64 | nyr++; 65 | } 66 | else 67 | { 68 | nmonth++; 69 | } 70 | calendar(nyr,nmonth); 71 | break; 72 | case 77: 73 | nyr++; 74 | calendar(nyr,nmonth); 75 | break; 76 | case 72: 77 | if(nmonth==1) 78 | { 79 | nyr--; 80 | nmonth=12; 81 | } 82 | else 83 | nmonth--; 84 | calendar(nyr,nmonth); 85 | break; 86 | case 75: 87 | if(nyr==1945) 88 | { 89 | gotoxy(15,2);printf("Year below 1945 not available"); 90 | } 91 | else 92 | { 93 | nyr--; 94 | calendar(nyr,nmonth); 95 | } 96 | 97 | break; 98 | case 27: 99 | system("cls"); 100 | gotoxy(50,14);printf("Exiting program.\n\n\n\n\n"); 101 | exit(0); 102 | case 112: 103 | system("cls"); 104 | goto enteryear; 105 | } 106 | } 107 | break; 108 | 109 | } 110 | getch(); 111 | return 0; 112 | } 113 | 114 | void display(int nyr,int nmonth,int tdays,int days[]) 115 | { 116 | int i,j,pos; 117 | SetColor(12); 118 | gotoxy(56,6);printf("%s %d",month[nmonth-1],nyr); 119 | for(i=0,pos=30;i<7;i++,pos+=10) 120 | { 121 | if(i==6) 122 | SetColor(9); 123 | else 124 | SetColor(10); 125 | gotoxy(pos,8);printf("%s",week[i]); 126 | } 127 | 128 | SetColor(15); 129 | 130 | tdays++; 131 | if(tdays==0 || tdays==7) 132 | pos=91; 133 | if(tdays==1) 134 | pos=31; 135 | if(tdays==2) 136 | pos=41; 137 | if(tdays==3) 138 | pos=51; 139 | if(tdays==4) 140 | pos=61; 141 | if(tdays==5) 142 | pos=71; 143 | if(tdays==6) 144 | pos=81; 145 | 146 | for(i=0,j=10,pos;i=1945) 205 | { 206 | for(k=1945;k<=myear;k++) 207 | { 208 | if(k%4==0) 209 | tdays=tdays+366; 210 | else 211 | tdays=tdays+365; 212 | } 213 | } 214 | 215 | if(nyr%4==0) 216 | days[1]=29; 217 | else 218 | days[1]=28; 219 | 220 | for(k=0;k<(nmonth-1);k++) 221 | { 222 | 223 | tdays=tdays+days[k]; 224 | } 225 | 226 | tdays=tdays%7; 227 | display(nyr,nmonth,tdays,days); 228 | } 229 | --------------------------------------------------------------------------------