Friday, July 31, 2009

Pls help me to have a source code in C++ that the input is user's birth year output is coressponding horoscope

Input: user's birth year


output: Chinese horoscope with corresponding elements





source code in c++

Pls help me to have a source code in C++ that the input is user's birth year output is coressponding horoscope
This is based on the info on the wikipedia page. Don't know if you need the extra heavenly/earthly fields.





#include %26lt;iostream%26gt;





using namespace std;





int main(int argc, char **argv)


{


int yr;





cin %26gt;%26gt; yr;





cout %26lt;%26lt; (((yr%2)==0)?"Yang ":"Yin ") ;





switch ((yr%10)/2)


{


case 0: cout %26lt;%26lt; "Metal"; break;


case 1: cout %26lt;%26lt; "Water"; break;


case 2: cout %26lt;%26lt; "Wood"; break;


case 3: cout %26lt;%26lt; "Fire"; break;


case 4: cout %26lt;%26lt; "Earth"; break;


}





cout %26lt;%26lt; ",";





switch (yr%12)


{


case 0: cout %26lt;%26lt; "Monkey"; break;


case 1: cout %26lt;%26lt; "Rooster"; break;


case 2: cout %26lt;%26lt; "Dog"; break;


case 3: cout %26lt;%26lt; "Boar"; break;


case 4: cout %26lt;%26lt; "Rat"; break;


case 5: cout %26lt;%26lt; "Ox"; break;


case 6: cout %26lt;%26lt; "Tiger"; break;


case 7: cout %26lt;%26lt; "Rabbit"; break;


case 8: cout %26lt;%26lt; "Dragon"; break;


case 9: cout %26lt;%26lt; "Snake"; break;


case 10: cout %26lt;%26lt; "Horse"; break;


case 11: cout %26lt;%26lt; "Sheep"; break;


}





cout %26lt;%26lt; endl;





return 0;


}
Reply:You will not find it anywhere. You may contact a C++ expert to code it for you. Check websites like http://oktutorial.com/


No comments:

Post a Comment