Joke Collection Website - Joke collection - C++ Chicken and rabbit cage A is the total number of chickens and rabbits, and B is the total number of feet. How many chickens and rabbits are there?

C++ Chicken and rabbit cage A is the total number of chickens and rabbits, and B is the total number of feet. How many chickens and rabbits are there?

Tell you a joke: New Olympiad! The chicken is sitting on the ground.

I have always been curious about a local tyrant friend who has never studied, but his business is quite big. I visited him today and finally found the answer! His son is doing homework, but he can't solve a problem. Ask us for help! The topic is: chicken and rabbit * *15, * * * has 40 feet, how many chickens and rabbits are there? I replied: "Let the number of chickens be X and the number of rabbits be Y" … I haven't worked out the answer yet, but my friend has given the answer! He said it was strange that you educated people were not disabled. His algorithm is: suppose chickens and rabbits are well trained, whistle and lift one foot, and 40- 15=25. Blow the whistle again and lift one foot, 25- 15= 10. At this time, the chicken is sitting on the ground, and the rabbit is still standing on two feet. So there are 10÷2=5 rabbits, 15-5= 10 chickens. This is why his son always comes first in mathematics. This algorithm makes Olympic math teachers feel embarrassed! I can only feel that I can't see the dead book when I study! Otherwise, we can't beat the local tyrants.

So according to the above algorithm, there is no need to use loops, which is more concise and clear. The process is as follows:

# include & ltiostream.h & gt

Master ()

{

Int chicken, sum foot

Cout & lt& lt "Total number of people =";

CIN & gt; & gt sum;

Cout & lt& ltendl & lt& lt "number of feet =";

CIN & gt; & gt feet;

Chicken = (foot -2 * and)/2;

Cout & lt& ltendl & lt& lt Chicken: "<& lt Chen Chi<< endl & lt" Rabbit: "<<& lt(sum-chicken)& lt; < & ltendl

System ("suspended");

}