第十六题.cpp
来自「算法设计与分析——清华大学出版社 书后习题代码」· C++ 代码 · 共 20 行
CPP
20 行
#include<iostream.h>
void main()
{
int a,b,c,d,i;
cout<<"please input a number from 1 to 100\n";
cout<<"please input the number divided by 3 has a remainder of:";
cin>>a;
cout<<"please input the number divided by 5 has a remainder of:";
cin>>b;
cout<<"please input the number divided by 7 has a remainder of:";
cin>>c;
cout<<"let me think a moment/n";
for(i=1;i<1500;i++)
d=70*a+21*b+15*c;
while(d>105)
d=d-105;
cout<<"your number is:"<<d;
}
/*心得:这个程序与书上给出的算法相同,我参照书上的算法的了此程序。*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?