百鸡百钱

来源:互联网 发布:合影软件 编辑:程序博客网 时间:2024/06/02 04:41
01./*           02.* Copyright (c) 2012, 烟台大学计算机学院           03.* All rights reserved.           04.* 文件名称:test.cpp           05.* 作者:刘卫丽       06.* 完成日期:2012 年 11月 8日           07.* 版本号:v1.0                08.* 输入描述:无           09.* 问题描述:百钱买百鸡 10.* 程序输出:学习使用读写文件!   11.* 问题分析:略           12.* 算法设计:略           13.*/     #include <iostream>   using namespace std;  int main ()  {      int x,y,z,count=0;      for(x=1;x<20;++x)          for(y=1;y<33;++y)              for(z=1;z<100;++z)                  if(5*x+3*y+z/3==100&&x+y+z==100)                {                  cout<<"x可能的值为"<<x<<endl;                  cout<<"y可能的值为"<<y<<endl;                  cout<<"z可能的值为"<<z<<endl;                                    }                  return 0;    }  


运行结果:

心得体会:方程中用等号不成吗?跪求原因