A simple menu driven period calculator build in C language as part of my mini-project in MCA Semester 1
To run this project, you need to install an IDE/Code Editor (Visual Studio Code is preferable) and also a C/C++ compiler on your system. Some popular compilers are:
- GCC on Linux
- GCC via Mingw-w64 on Windows
- Microsoft C++ compiler on windows
- Clang for XCode on MacOS
Check out this link to know how to run a C program in Visual Studio Code.
gcc periods_tracker.c -o periods_tracker
.\periods_tracker
// stucture to hold the period details
struct period_details
{
int day;
int month;
int year;
int cycle_length;
int period_length;
}periods;
int day = periods.day;
int month = periods.month;
int year = periods.year;
int days_in_month;
for (int i = 0; i < 3; i++){
day += periods.cycle_length;
if (day > days_in_month){
day -= days_in_month;
month++;
if (month > 12){
month = 1;
year++;
}
}
printf("\t=> \t%d/%d/%d\n\n", day, month, year);
}