C++猜数字问题心里先想好一个1~100之间的整数,将它分别除以3,4和7并得到3个余数.把这3个余数输入计算机,计算机能马上猜出这个数.Please think of anumber between 1 and 100Your numberdivided by 3 has a remainde
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 06:28:56
C++猜数字问题心里先想好一个1~100之间的整数,将它分别除以3,4和7并得到3个余数.把这3个余数输入计算机,计算机能马上猜出这个数.Please think of anumber between 1 and 100Your numberdivided by 3 has a remainde
C++猜数字问题
心里先想好一个1~100之间的整数,将它分别除以3,4和7并得到3个余数.把这3个余数输入计算机,计算机能马上猜出这个数.
Please think of anumber between 1 and 100
Your numberdivided by 3 has a remainder of 1
Your numberdivided by 4 has a remainder of 0
Your number dividedby 7 has a remainder of 5
Let me think amoment …
Your number was 40
C++猜数字问题心里先想好一个1~100之间的整数,将它分别除以3,4和7并得到3个余数.把这3个余数输入计算机,计算机能马上猜出这个数.Please think of anumber between 1 and 100Your numberdivided by 3 has a remainde
学语言就得先模仿,不过一定要经过自己去想,理解,消化.
下面是我做的,给你参考下吧.代码还能优化,你来优化下吧.
#include
using namespace std;
int main(int argc, char *argv[])
{
int a[35]={0};
int b[35]={0};
int c[35]={0};
int x,y,z;
printf("请输入你所想数除以3后的余数:");
scanf("%d",&x);
//printf("%d\n",x);
printf("请输入你所想数除以4后的余数:");
scanf("%d",&y);
printf("请输入你所想数除以7后的余数:");
scanf("%d",&z);
if(x==0&&y==0&&z==0)
printf("你所想的数是:0\n");
for(int i=1;i