Alex's profileAlexPhotosBlogLists Tools Help

Blog


    October 21

    To love or not to love, that is the question

    void love(char Say_yes)
    {
       if (Say_yes != 'y' && Say_yes != 'Y')
       {
          cout<<"i still love you,";
          cout<<"Could you give me one more chance, please!!? (y or n): ";
          cin>>Say_yes;
          love(Say_yes);      //function calls itself
       }
    }
    October 08

    Monkey && Coco

    (The Monkey and the Coconuts.) After a plane crash, 5 men found themselves stranded on a desert island. The only food source on the island was coconuts, which were plentiful, and the only other inhabitant of the island was a monkey. The men spent their first day gathering coconuts, which they put into a large pile. They were so tired after gathering coconuts, they decided to leave the problem of dividing them until the next day. However, in the middle of the night, one of the men woke up and decided to take his share. He found that the pile of coconuts divided evenly into five with one coconut left over. He stashed his fifth, gave the leftover coconut to the monkey, left the rest of the coconuts in a pile for the others, and went back to sleep. However, a second man woke up afterwards, and also decided to do the same thing. Coincidentally, when he divided the remaining pile into five, there was again one left over for the monkey. He stashed his fifth. Each of the other three men went through the same process at some time during the night, each time with one leftover coconut for the monkey. In the morning when they woke up, none of them admitted to taking a portion already, so they divided the remaining pile into fifths, this time with none left over for the monkey. How many coconuts did they originally gather?