Mini project “Calendar Application” in C – Free Code Download.
Mini project “Calendar Application” is also a simple project built in C. This project has following features.
- It displays a nicely formatted calendar of every month.
- You can find the day by entering the day, month and year. For example, if you enter day = 10, month = 03 and year = 1991, it gives you the day ‘Sunday’.
- You can add the note for a particular day.
- If the given month has a note in it, it will display || in that day.
You can play with the source code and modify as per your need. Please remember it is just a sample project. Do not submit it as it is, as a part of your project. The source code for this project is also available on GitHub.
Here are the full lists of the Mini Projects in C/C++
#include <stdio.h> #include <stdlib.h> int isLeapYear( int year ); /* True if leap year */ int leapYears( int year ); /* The number of leap year */ int todayOf( int y, int m, int d); /* The number of days since the beginning of the year */ long days( int y, int m, int d); /* Total number of days */ void calendar(int y, int m); /* display calendar at m y */ int getDayNumber(int d,int m,int y); char *getName(int day); // Copied from // https://stackoverflow.com/questions/35103745/read-a-string-as-an-input-using-scanf void flush() { int c; while ((c = getchar()) != '\n' && c != EOF); } typedef struct { int day; int month; int year; char note[255]; } Note; int main(int argc, char* argv[]){ int year,month, day; char choice; Note note; FILE *fp; fp = fopen("note.bin", "r"); if (fp == NULL) { fp = fopen("note.bin", "w"); } fclose(fp); while(1) { printf("1. Find the day\n"); printf("2. Print calendar of a month\n"); printf("3. Add Note\n"); printf("4. Exit\n"); printf("Enter your choice: "); scanf("\n%c", &choice); switch(choice) { case '1': printf("Enter the day, month and year: "); scanf("%d %d %d", &day, &month, &year); printf("The day is : %s\n", getName(getDayNumber(day, month, year))); break; case '2': printf("Enter the month and year: "); scanf("%d %d", &month, &year); printf("Please enter 's' to see the notes\n Press any other key to continue\n"); calendar(year, month); break; case '3': printf("Enter the day, month and year: "); scanf("%d %d %d", ¬e.day, ¬e.month, ¬e.year); flush(); printf("Enter the note: "); fgets(note.note, 255, stdin); fp = fopen("note.bin", "a+"); if (fp == NULL) { printf("File note.bin can not be opened\n"); exit(1); } fwrite(¬e, sizeof(Note), 1, fp); printf("Note added sucessfully\n"); fclose(fp); break; case '4': printf("Bye!!"); exit(0); break; default: printf("Not a valid option\n"); break; } } return 0; } int isLeapYear( int y ){ return(y % 400 == 0) || ((y % 4 == 0) && (y % 100 != 0)); } int leapYears( int y ){ return y/4 - y/100 + y/400; } int todayOf( int y, int m, int d) { static int DayOfMonth[] = { -1,0,31,59,90,120,151,181,212,243,273,304,334}; return DayOfMonth[m] + d + ((m>2 && isLeapYear(y))? 1 : 0); } long days( int y, int m, int d){ int lastYear; lastYear = y - 1; return 365L * lastYear + leapYears(lastYear) + todayOf(y,m,d); } void calendar(int y, int m){ FILE *fp; Note* notes, note; int len, j, hasNote = 0; char choice; const char *NameOfMonth[] = { NULL/*dummp*/, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; char Week[] = "Su Mo Tu We Th Fr Sa"; int DayOfMonth[] = { -1,31,28,31,30,31,30,31,31,30,31,30,31 }; int weekOfTopDay; int i,day; weekOfTopDay = days(y, m, 1) % 7; fp = fopen("note.bin", "rb"); if (fp == NULL) { printf("Couldn't read notes\n"); } len = 0; while(fread(¬e, sizeof(Note), 1, fp)) { if (note.year == y && note.month == m) { len++; } } rewind(fp); j = 0; notes = (Note*) malloc (sizeof(Note) * len); while(fread(¬e, sizeof(Note), 1, fp)) { if (note.year == y && note.month == m) { notes[j] = note; j++; } } fclose(fp); if(isLeapYear(y)) DayOfMonth[2] = 29; printf("\n %s %d\n%s\n", NameOfMonth[m], y, Week); for(i=0;i<weekOfTopDay;i++) printf(" "); for(i=weekOfTopDay,day=1;day <= DayOfMonth[m];i++,day++){ hasNote = 0; for (j = 0; j < len; j++) { if (notes[j].day == day) { printf("|%2d| ",day); hasNote = 1; break; } } if (hasNote == 0) { printf("%2d ",day); } if(i % 7 == 6) printf("\n"); } printf("\n"); scanf("\n%c", &choice); if (choice == 's') { printf("Here are list of notes for %d %d\n", m, y); for (j = 0; j < len; j++) { printf("%d: %s\n", notes[j].day, notes[j].note); } } else { return; } } int getDayNumber(int d, int m, int y){ //retuns the day number static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}; y -= m < 3; return (y + y/4 - y/100 + y/400 + t[m-1] + d) % 7; } char *getName(int day){ //returns the name of the day switch(day){ case 0 :return("Sunday"); case 1 :return("Monday"); case 2 :return("Tuesday"); case 3 :return("Wednesday"); case 4 :return("Thursday"); case 5 :return("Friday"); case 6 :return("Saturday"); default:return("Error: Invalid Argument Passed"); } }
where is the programme snippet
this is a link to download the code at the end of the post.
Hi, I do think this iѕ a gгeat wеbsite.
Ι ѕtumbledupon it 😉 I am goіng to revisit once аgаin sinсе I book marκеԁ it.
Money and freeԁom is thе greatest ωау
tο change, may yоu be гіch anԁ
contіnuе to helр otheгѕ.
Hi I am sо gгаtеful I found уour sitе, I really found you by error, while I wаs
browsіng on Yahοο for somethіng else, Αnyhow I am here now anԁ ωould juѕt
lіκe to ѕay thank you fοr a rеmarkаble poѕt and a
all round enјoyаblе blog (I alsο love the thеmе/deѕign), I ԁοn’t have
time to gο through it all at thе minute but I have bookmarkеd іt and аlsο addеd yοuг RSЅ
fеeds, so when ӏ have tіme I will be bасk tο
reaԁ moгe, Рlеasе ԁo keep uρ the fantаstic
work.
Feel free to surf my webpage … sulaman
Hello
Mit vollen Respekt , wie Sie einfach und verständlich und kompakt bie Nummerische Mathematik dargestellt haben und weiter so, ich wünsche Ihnen viel Erfolg
Marouf
Vielen Dank
Marouf
hello there, calender program is well build but how to run the same program within turbo c editor, because after adding all required header files still there are 15 errors.
so please let me know the steps to run the source file
thanks
You must remove #include from the file. Also you don't need the definition of gotoxy, color function and background function, delete all of them becoz torbo c has all those features as builtin function
Hai…in calender progamme we got Declaration Syntax error in The place of Coord xy={0,0}
Thanking You
You must include windows.h header file. Coord is typedef structure defined under windows.h. This may help to reduce error
Even Though we got same error
Hai…in calender progamme we got Declaration Syntax error in The place of Coord xy={0,0}
please reply
Thanking You
Hey,tell me that how can i run this program in Turbo C and
if it will not run in turbo C then then which compiler i have to use to run this program..
reply me
Ya you can modify the code so that it can run under turbo C compiler .But I suggest you to compile it under MinGW GCC compiler. Just download the Code::Blocks IDE from http://www.codeblocks.org/downloads which contains GCC compiler and compile the code.
hey,thank you i got that…. but i also want to run that program in Turbo C…as u saying that to remove the definition of gotoxy, color function and background function but still there is problem of linker erros…and also windows.h file is not included in Turbo C.
so tell me what i have to do…
hey,there are three options Binaries,Source,SVN which one i have to select…please tell me, i am confused…
You should download Binaries
Windows.h is only for windows and gcc, it is neither in Turbo C nor in linux or Mac. You should remove windows.h
got Declaration Syntax error in The place of Coord xy={0,0}
then….
In turbo C you don't need the declaration of Coord because it is only defined in windows.h. Just erase the line Coord xy = {0, 0} and run
Thank you sir…
can u send any project on c with abstract and sourse code….
i hav got error in number 2.. plz fix it…
Ist error message is "Unable to open #include WINDOWS.H".
In my pc it is giving 25 errors, starting with undefined symbol xy!
unable to open dates its giving error for the entire years
i want to create a 100 year calander at my own so please help me in doing so.
Make sure you ran this project on windows with MinGW GCC compiler
windows.h is only available in Windows machine, if will definitely get error if run in other machine
Hello Pidugu the error is due to the missing file. IF you add some notes first and then open the calendar it works. This is simple logical error.
i need code of this program
sir bibek subedi
while adding notes it takes only dd and mm so when we want to see that note we are not able to see that
i think this is because it is not taking year as parameter as without knowing the year how it could identify that in which dd mm and year the note is added
Will this work on turbo c++
Great Website, I found my project.
Please Do Write Programs that Works On Linux…please because Students Use Linux for Programming…
will this code work on visual studio c++?
no
no
no Bakhtawer it doesn't on on visual studio
How can I get codings of app??
Hello , Admin I have some Error in Code block
Undeclared scanf("%d %d %d",&date.dd,&date.mm,&date.yy);
How can I do ?
please send me this code
[email protected]
the link is not working
Hey Bibek Subedi I have this assignment that I love for you to help me with1. Create a simple bike racing game that allows the user to escape from onscreen obstacles to reach the finish line. The game should have a minimum of 2 levels; An onscreen menu; and. instructions on how to play
@Bibek Subedi ?????
search in google calendar mini project in c
approve my request
need an abstract
need an absract
need an abstract for this program
need an abstract for this program
sir please send me the code for this calendera
email id:) [email protected]
Is there something wrong with the link? It seems to have expired.
could you plz send me the source code
sir how can i get the code
where is code?
where is download link of code
im so helpful to your project plan.so great thinking.
thank you
where is code?
Which data structure is used here
Which data structure is used here
I added a note but it isn't getting displayed.
Nyc sir ….i am in the first year student at computer science unviersity (software engineering)
.
Thanks for the source code
note file is not working
I want report for this calender program
sir, please send me the source code for calendar program