回复 10# 的帖子
让程序停下来,我们可以看看结果。
/*逆向算法*/
#include <iostream.h>
int count(int day);
void main()
{
int day;
int sum;
cout<<"please input the monkey eat day's"<<endl;
cin>>day;
sum = count(day);
cout<<"first day the monkey eat:"<<sum;
}
int count(int day)
{
int i;
int sum = 1;
for (i = 0; i < 9; i++)
{
sum = (sum + 1) * 2;
}
return sum;
}