#include"iostream.h" void main() { int x,y,z; x=0; while(x<=20) { y=0; while(y<=33) { z=100-x-y; if(5.0*x+3.0*y+z/3.0==100.0) cout<<"公鸡的个数:"<<x<<"母鸡的个数:"<<y<<"小鸡的个数:"<<z<<endl; y++; } x++; } } 最典型的例题之百钱买百鸡,欢迎大家来看奥!!!