Skip to content

Instantly share code, notes, and snippets.

@Eugeny
Created March 10, 2011 18:33
Show Gist options
  • Save Eugeny/864607 to your computer and use it in GitHub Desktop.
Save Eugeny/864607 to your computer and use it in GitHub Desktop.
--- Horoscope1.cpp 2011-03-10 20:30:49.127143766 +0200
+++ Horoscope.cpp 2011-03-10 20:31:11.627142105 +0200
@@ -87,8 +87,8 @@
{
FirstPerson.sign = WhatSign(HowManyDays(FirstPerson.month, FirstPerson.day));
SecondPerson.sign = WhatSign(HowManyDays(SecondPerson.month, SecondPerson.day));
- printf("Sign of first parner:%s\n",*signs[FirstPerson.sign]);
- printf("Sign of second parner:%s\n",*signs[SecondPerson.sign]);
+ printf("Sign of first parner:%s\n",signs[FirstPerson.sign-1]);
+ printf("Sign of second parner:%s\n",signs[SecondPerson.sign-1]);
break;
}
case 4:
@@ -121,13 +121,12 @@
int WhatSign(int birthdays)
{
- int sign = 12, i = 0;
+ int i = 0;
while ((birthdays > days[i]) && (i <= 11))
{
- sign = i + 1;
i++;
}
- return sign;
+ return i+1;
}
int HowManyDays(int month, int day)
@@ -149,4 +148,4 @@
return 3;
if ((sign == 6) || (sign == 10) || (sign == 2))
return 4;
-}
\ В конце файла нет новой строки
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment