#include <iostream>
int main()
{
using namespace std;
unsigned short small;
unsigned long large;
unsigned long skip;
unsigned long target;
const unsigned short MAXSMALL=65536;
cout<<"enter a smll number:";
cin>>small;
cout<<"enter a large number:";
cin>>large;
cout<<"enter a skip number:";
cin>>skip;
cout<<"enter a target number:";
cin>>target;
cout<<"\n";
while (small<large && large>0 && small<MAXSMALL)
{
small++;
if (small%skip==0)
{
cout<<"skipping on"<<small<<endl;
continue;
}
if (large==target)
{
cout<<"target reached!";
break;
}
large-=2;
}
cout<<"\nsmall:"<<small<<"large:"<<large<<endl;
return 0;
}
我输入了2 ,20 ,4 ,6这四个数字,按道理说应该显示
Skipping on 4
Skipping on 8
Small 10 large 8
为什么我的输出是small:2 large:20
为什么我前面的条件语句没起作用?