#include <iostream>
#include <string>
using namespace std;
int main()
{
int day = 0;
int month = 0;
int year = 0;
int result = 0;
int oneDay = 0;
cout << "Enter DAY of yourself birthday: ";
cin >> day;
cout << "Enter number of MONTH of yourself birthday (Example: January = 1, June = 6): ";
cin >> month;
cout << "Enter YEAR of yourself birthday: ";
cin >> year;
/* проверяем является ли год високосным
если год является високосным, то в дальнейшем мы прибавим 1 день */
if (year % 4 == 0) oneDay = 1;
if ((year % 4 == 0) && (year % 100 == 0)) oneDay = 0;
if ((year % 4 == 0) && (year % 100 == 0) && (year % 400 == 0)) oneDay = 1;
if (oneDay == 1) cout << endl << year << " - this is leap year (visokosnii god), February has 29 day.\n";
switch (month){
case 1: result = day; break;
case 2: result = 31 + day; break;
case 3: result = 31 + 28 + oneDay + day; break;
case 4: result = 31 + 28 + oneDay + 31 + day; break;
case 5: result = 31 + 28 + oneDay + 31 + 30 + day; break;
case 6: result = 31 + 28 + oneDay + 31 + 30 + 31 + day; break;
case 7: result = 31 + 28 + oneDay + 31 + 30 + 31 + 30 + day; break;
case 8: result = 31 + 28 + oneDay + 31 + 30 + 31 + 30 + 31 + day; break;
case 9: result = 31 + 28 + oneDay + 31 + 30 + 31 + 30 + 31 + 31 + day; break;
case 10: result = 31 + 28 + oneDay + 31 + 30 + 31 + 30 + 31 + 31 + 30 + day; break;
case 11: result = 31 + 28 + oneDay + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + day; break;
case 12: result = 31 + 28 + oneDay + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + day; break;
default : result = 0;
}
cout << endl << result << endl << endl;
cout << "You are - ";
if (result <= 20) cout << " kozerog";
else if (result <= 50) cout << " vodoley";
else if (result <= (79+oneDay)) cout << " fish";
else if (result <= (110+oneDay)) cout << " oven";
else if (result <= (141+oneDay)) cout << " telec";
else if (result <= (172+oneDay)) cout << " twins";
else if (result <= (204+oneDay)) cout << " rak";
else if (result <= (235+oneDay)) cout << " lev";
else if (result <= (266+oneDay)) cout << " deva";
else if (result <= (296+oneDay)) cout << " vesi";
else if (result <= (326+oneDay)) cout << " scorpion";
else if (result <= (355+oneDay)) cout << " strelec";
else if ((result > (355+oneDay)) && (result <= (365+oneDay))) cout << " kozerog";
return 0;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.