Calander
Calander
int main() {
cout<<"Enter the Gregorian Date that you want to convert eg -> (Jun 15
2017) \n";
cin>>month>>day>>year;
return 0;
}
Not Completed, will update faster!
include <iostream>
#include <map>
#include <tuple>
string gregorian_month[12] = {
"Sep", "Oct", "Nov", "Dec", "Jan", "Feb",
"Mar", "Apr", "May", "Jun", "Jul", "Aug"
};
string ethiopian_month[13] = {
"Mes", "Tik", "Hid", "Tah", "Tir", "Yek", "Meg",
"Miy", "Gin", "Sen", "Ham", "Neh", "Pau"
};
/**
@param { int } year => gregorian year
@return { isLeapYear ? true : false }
@throw { Invalid Year ERROR }
*/
if(year % 4 == 0) {
if(year % 100 == 0) {
if(year % 400 == 0) {}
return true;
}
} else {
return false;
/**
@param { int } year
@param { int } month
@param { int } day
@return year
@throw { Invalid Year ERROR }
*/
cout<<"Year -- "<<endl;
return year - 8;
} else {
return year - 9;
} else {
return year - 8;
/**
@param { string } month => shortened_gregorian_month_name
@return the month number
@throw { Can't Find Month ERROR }
*/
int monthNumber;
if(gregorian_month[i] == month) {
monthNumber = i + 1;
return monthNumber;
/**
@param { string } month - The month name
@return { int } day_to_r - day number
@throw Invalid Month Error
*/
MapMonth gregorian_to_ethiopian;
if(day_to_r < 1) {
gregorian_to_ethiopian[gregorian_month[i]] = ethiopian_month[i-1];
monthNumber = get_month(month);
day_f = day_to_r;
gregorian_to_ethiopian[gregorian_month[i]] = ethiopian_month[i];
/**
@param { int } year
@param { string } month => shortened_gregorian_month_name
@param { int } day
@return { int } day - converted day
@throw { Invalid Year, Month, Day => Error }
*/
int monthIndex;
int day_to_r;
if(isLeapYear(year) == true) {
/**
* Handle Leap Years
*/
monthIndex = get_month(month);
switch(monthIndex) {
case 12:
day_to_r = day - month_days_difference[monthIndex - 1];
default:
day_to_r = day - month_days_difference[monthIndex - 1];
}
} else {
// Handle Non Leap Years
monthIndex = get_month(month);
switch(monthIndex) {
case 12:
day_to_r = day - month_days_difference[monthIndex - 1];
default:
day_to_r = day - month_days_difference[monthIndex - 1];
}
return day_to_r;
}
/**
@param { int } year - gregorian_year
@param { string } month - shortened_gregorian_month_name
@param { int } day
@return { year_converted, month_converted, day_converted }
@throw { Invalid Year, Month, Day => Error }
*/
string month_conv;
int day_conv, year_conv, monthNumber, day_to_ret;
monthNumber = get_month(month);
month_conv = mapped_month.first;
day_conv = mapped_month.second;