hello all,
i'm a biology student currently taking programming in uni, and i have a homework question to solve.
i have to write a programme to create and print a one-month calendar which can be used as month and year calendars as well.
the programme should be able to;
1. detect the leap years and non-leap years
2. identify the first day (mon, tue, wed, etc)
3. identify the days in a month (number of days)
4. additional features such as help menu and other creative functions
for this assignment, my other group members and i are doing the different parts. i have written the codes for the first part (leap years) but i'm not very sure if it would work.
my greatest concern is whether we would be able to compile all the three different functions into one working programme, since we are all new to C++. i need some advice as to how to compile them
example of a code my instructor printed out for me;
#include <stdio.h>
/* 1' == leap year, 0' != leap year */
int is_leap_year (int year);
int main (void)
{
int years [4] = {2000, 2004, 2008, 2012);
int i = 0;
for (i = 0; i < 4; i++)
{
if (is_leap_year (years[i])==1)
printf ("%d is a leap year\n", years [i]);
else
printf ("%d is not a leap year\n", years [i]);
}
return 0;
}
we are using the C software but saving it under C++ since we don't have C++ in our school lab.
the actual codes i have written is different from this as i use the (year%4), (year%100==0) and (year%400==0) formula. i just need to know if the codes i typed earlier are more appropriate to be used in my assignment, because i do not understand them well
i also hope you can suggest to me some creative features to be added to my calendar to make it more interesting
any help is greatly appreciated, thank you
*added
i'm very sorry if i did not make myself clear, i mean we are using the C software in our school, so i have to use C code, but we are learning C++. i don't really understand this myself, my lecturer explained it to me. and i have solved the first part of the project. i'll be very thankful for everyone's help ^^