বন্ধুরা সবাই কেমন আছ?
আজ তোমাদের দেখাবো কিভাবে c++ ব্যবহার করে ক্যালেন্ডার তৈরি করা জায়।
ত বন্ধুরা দেরি না করে চল সুরু করা জাক।
আমি dev c++ ব্যবহার করে প্রোগ্রাম তি তইরি করেছি,
প্রথমে নিচের কোড গুল কপি করে dev c++ এ পেস্ট করুন।
#include<iostream> #include <time.h> using namespace std; int main () { int year , x, z,y, j,f ,numofdays; string month; char o; cout<<" this is mustakims calender"<<endl; cout<<"\n\n\n\n\n"; cout<<" 1- if you want only month calender....click m \n"; cout<<" 2- if you want all months of the year ...click n \n"; cout<<" 3- if you want the months from any month to the end of the year...click..t \n "; cout<<"4- if you want the months from any month to the begain of the year...click..k \n "; cout<<"5- if you want to know the day of a year ..click l \n "; cin>>o; //ÈÊÇÚ ÔåÑ Ýí ÇáÓäå if(o=='m'){ cout<<" month ...january , february , march , april , may ,june , july , august , september , octobar ,november , december\n "; cout<<"entre the month ..&&.. year\n"; cin>>month; cin>>year; x=year-1; y=x/4; z=x*365+y+2; while (z>7){z=z-7;} if(year%4==0){f=29;} else f=28; if(month=="january"){j=z; numofdays=31;} if(month=="february"){j=z+31; numofdays=f;} if(month=="march"){j=z+31+f; numofdays=31;} if(month=="april"){j=z+31+f+31; numofdays=30;} if(month=="may"){j=z+31+f+31+30; numofdays=30;} if(month=="june"){j=z+31+f+31+30+30+1; numofdays=30;} if(month=="july"){j=z+31+f+31+30+30+30+1; numofdays=31;} if(month=="august"){j=z+31+f+31+30+30+30+31+1; numofdays=31;} if(month=="september"){j=z+31+f+31+30+30+30+31+31+1; numofdays=30;} if(month=="octobar"){ j=z+31+f+31+30+30+30+31+31+30+1; numofdays=31;} if(month=="november"){j=z+31+f+31+30+30+30+31+31+30+31+1; numofdays=30;} if(month=="december"){j=z+31+f+31+30+30+30+31+31+30+31+30+1; numofdays=31;} while (j>7){j=j-7;} cout<<"sa\tsu\tmo\ttu\twe\tth\tfr\t\n"; for(int q=1 ; q<j ;q++){cout<<" \t";} for(int i=1; i<=numofdays; i++){cout<<i<<"\t"; if((i+(j-1))%7==0)cout<<endl; } cout<<endl; cout<<endl; } if(o=='n'){cout<<"entre the year\n"; cin>>year; ; x=year-1; y=x/4; z=x*365+y+2; while (z>7){z=z-7;} if(year%4==0){f=29;} else f=28; for(int e=1; e<=12; e++){switch(e){ case 1: month="january"; cout<<"january "<<year<<endl; break; case 2: month="february"; cout<<"february "<<year<<endl; break; case 3: month="march"; cout<<"march "<<year<<endl; break; case 4: month="april"; cout<<"april "<<year<<endl; break; case 5: month="may"; cout<<"may "<<year<<endl; break; case 6: month="june"; cout<<"june "<<year<<endl; break; case 7: month="july"; cout<<"july "<<year<<endl; break; case 8: month="august"; cout<<"august "<<year<<endl; break; case 9: month="september"; cout<<"september "<<year<<endl; break; case 10: month="october"; cout<<"october "<<year<<endl; break; case 11: month="november"; cout<<"november "<<year<<endl; break; default : month="december"; cout<<"december "<<year<<endl; } if(month=="january"){j=z; numofdays=31;} if(month=="february"){j=z+31; numofdays=f;} if(month=="march"){j=z+31+f; numofdays=31;} if(month=="april"){j=z+31+f+31; numofdays=30;} if(month=="may"){j=z+31+f+31+30; numofdays=30;} if(month=="june"){j=z+31+f+31+30+30+1;//ÈÕ 1 Ïå ÇäÇ ÍÊÇØæ ÚáÔÇä ÇáÔåæÑ ÈÚÏ ãÇíæ ÈÊßæä äÇÞÕå íæã ãÔ ÚÇÑÝ áíå numofdays=30;} if(month=="july"){j=z+31+f+31+30+30+30+1; numofdays=31;} if(month=="august"){j=z+31+f+31+30+30+30+31+1; numofdays=31;} if(month=="september"){j=z+31+f+31+30+30+30+31+31+1; numofdays=30;} if(month=="octobar"){j=z+31+f+31+30+30+30+31+31+30+1+2; numofdays=31;} if(month=="november"){j=z+31+f+31+30+30+30+31+31+30+31+1; numofdays=30;} if(month=="december"){j=z+31+f+31+30+30+30+31+31+30+31+30+1; numofdays=31;} while (j>7){j=j-7;} cout<<"sa\tsu\tmo\ttu\twe\tth\tfr\t\n"; for(int q=1 ; q<j ;q++){cout<<" \t";} for(int i=1; i<=numofdays; i++){cout<<i<<"\t"; if((i+(j-1))%7==0)cout<<endl; } cout<<endl; cout<<endl; } } //ÈÊÇÚ ÇáÔåæÑ ãä ÔåÑ Çáí ÇÎÑ ÇáÓäå if(o=='t'){ cout<<"entre the year\n"; cin>>year; x=year-1; y=x/4; z=x*365+y+2; while (z>7){z=z-7;} if(year%4==0){f=29;} else f=28; for(int u=1;u<=12;u++) { if(u==1){ cout<<"entre the month\n"; cin>>month; if(month=="january"){u=1;} if(month=="february"){u=2;} if(month=="march"){u=3;} if(month=="april"){u=4;} if(month=="may"){u=5;} if(month=="june"){u=6;} if(month=="july"){u=7;} if(month=="august"){u=8;} if(month=="september"){u=9;} if(month=="octobar"){u=10;} if(month=="november"){u=11;} if(month=="december"){u=12;} } if(u==1){j=z; cout<<"january , "<<year<<endl; numofdays=31;} if(u==2){j=z+31; cout<<"february , "<<year<<endl; numofdays=f;} if(u==3){j=z+31+f; cout<<"march , "<<year<<endl; numofdays=31;} if(u==4){j=z+31+f+31; cout<<"april , "<<year<<endl; numofdays=30;} if(u==5){j=z+31+f+31+30; cout<<"may , "<<year<<endl; numofdays=30;} if(u==6){j=z+31+f+31+30+30+1; cout<<"june , "<<year<<endl; numofdays=30;} if(u==7){j=z+31+f+31+30+30+30+1; cout<<"july , "<<year<<endl; numofdays=31;} if(u==8){j=z+31+f+31+30+30+30+31+1; cout<<"august , "<<year<<endl; numofdays=31;} if(u==9){j=z+31+f+31+30+30+30+31+31+1; cout<<"september , "<<year<<endl; numofdays=30;} if(u==10){ j=z+31+f+31+30+30+30+31+31+30+1; cout<<"october , "<<year<<endl; numofdays=31;} if(u==11){j=z+31+f+31+30+30+30+31+31+30+31+1; cout<<"november , "<<year<<endl; numofdays=30;} if(u==12){j=z+31+f+31+30+30+30+31+31+30+31+30+1; cout<<"december , "<<year<<endl; numofdays=31;} while (j>7){j=j-7;} cout<<"sa\tsu\tmo\ttu\twe\tth\tfr\t\n"; for(int q=1 ; q<j ;q++){cout<<" \t";} for(int i=1; i<=numofdays; i++){cout<<i<<"\t"; if((i+(j-1))%7==0)cout<<endl;} cout<<endl<<endl; }} //ÈÊÇÚ ÇáÔåæÑ ãä ÔåÑ Çáí ÈÏÇíå ÇáÓäå if(o=='k'){ cout<<"entre the year\n"; cin>>year; x=year-1; y=x/4; z=x*365+y+2; while (z>7){z=z-7;} if(year%4==0){f=29;} else f=28; for(int u=12;u>=1;u--) { if(u==12){ cout<<"entre the month\n"; cin>>month; if(month=="january"){u=1;} if(month=="february"){u=2;} if(month=="march"){u=3;} if(month=="april"){u=4;} if(month=="may"){u=5;} if(month=="june"){u=6;} if(month=="july"){u=7;} if(month=="august"){u=8;} if(month=="september"){u=9;} if(month=="octobar"){u=10;} if(month=="november"){u=11;} if(month=="december"){u=12;} } if(u==1){j=z; cout<<"january , "<<year<<endl; numofdays=31;} if(u==2){j=z+31; cout<<"february , "<<year<<endl; numofdays=f;} if(u==3){j=z+31+f; cout<<"march , "<<year<<endl; numofdays=31;} if(u==4){j=z+31+f+31; cout<<"april , "<<year<<endl; numofdays=30;} if(u==5){j=z+31+f+31+30; cout<<"may , "<<year<<endl; numofdays=30;} if(u==6){j=z+31+f+31+30+30+1; cout<<"june , "<<year<<endl; numofdays=30;} if(u==7){j=z+31+f+31+30+30+30+1; cout<<"july , "<<year<<endl; numofdays=31;} if(u==8){j=z+31+f+31+30+30+30+31+1; cout<<"august , "<<year<<endl; numofdays=31;} if(u==9){j=z+31+f+31+30+30+30+31+31+1; cout<<"september , "<<year<<endl; numofdays=30;} if(u==10){ j=z+31+f+31+30+30+30+31+31+30+1; cout<<"october , "<<year<<endl; numofdays=31;} if(u==11){j=z+31+f+31+30+30+30+31+31+30+31+1; cout<<"november , "<<year<<endl; numofdays=30;} if(u==12){j=z+31+f+31+30+30+30+31+31+30+31+30+1; cout<<"december , "<<year<<endl; numofdays=31;} while (j>7){j=j-7;} cout<<"sa\tsu\tmo\ttu\twe\tth\tfr\t\n"; for(int q=1 ; q<j ;q++){cout<<" \t";} for(int i=1; i<=numofdays; i++){cout<<i<<"\t"; if((i+(j-1))%7==0)cout<<endl;} cout<<endl<<endl; }} //ÈÊÇÚ íæã Ýí ÇáÓäå if(o=='l'){ cout<<"entre the year\n"; cin>>year; cout<<"entre the day\n"; int a; cin>>a; x=year-1; y=x/4; z=x*365+y+2; while (z>7){z=z-7;} if(year%4==0){f=29;} else f=28; j=z+a-1; while(j>7){j=j-7;} if(j==1){cout<<"saturday , ";} if(j==2){cout<<"sunday , ";} if(j==3){cout<<"monday , ";} if(j==4){cout<<"tuesday , ";} if(j==5){cout<<"wednesday , ";} if(j==6){cout<<"thursday , ";} if(j==7){cout<<"friday , ";} if(a>=1 && a<=31 ){cout<<"january , ";} if(a>=32 && a<=31+f ){cout<<"february , ";} if(a>=23+f && a<=62+f ){cout<<"march , ";} if(a>=63+f && a<=92+f ){cout<<"april , ";} if(a>=93+f && a<=122+f ){cout<<"may , ";} if(a>=123+f && a<=152+f ){cout<<"june , ";} if(a>=153+f && a<=183+f ){cout<<"july , ";} if(a>=184+f && a<=214+f ){cout<<"august , ";} if(a>=215+f && a<=244+f ){cout<<"september , ";} if(a>=245+f && a<=275+f ){cout<<"october , ";} if(a>=276+f && a<=305+f ){cout<<"november , ";} if(a>=306+f && a<=337+f ){cout<<"december , ";} cout<<year<<endl; } time_t curtime; time(&curtime); printf("Current time = %s", ctime(&curtime)); system("pause"); return 0; } এর পর compile করুন। এই ক্যালেন্ডার এর সুভিদা সরাসরি date dekha jabe, পুর ১২ মাসের ক্যালেন্ডার দেখতে ছাইলে সেটাও হবে। আমার জানা মতে এটাতে কোন problem নাই। এর পরেও কোন সমসসা হলে আমাকে অবশ্যই জানাবেন। best of luck :)
আমি মুসতাকিম বিল্লাহ। বিশ্বের সর্ববৃহৎ বিজ্ঞান ও প্রযুক্তির সৌশল নেটওয়ার্ক - টেকটিউনস এ আমি 11 বছর 9 মাস যাবৎ যুক্ত আছি। টেকটিউনস আমি এ পর্যন্ত 68 টি টিউন ও 41 টি টিউমেন্ট করেছি। টেকটিউনসে আমার 1 ফলোয়ার আছে এবং আমি টেকটিউনসে 0 টিউনারকে ফলো করি।
vaia code ta ki bujhie dite parben kindly?