cout<<"Distance of first jump <="<<x<<" "<<":"<<" ";
cout<<"incorrect first jump distance, setting first jump distance to: "<<x<<endl;
1) Input a positive integer total that represents the total distance in meters a person needs to travel.
2) Input a positive integer first that represents the distance of the first jump. This distance should be less than or equal to total/20. If first is greater than total/20 then set it to total/20.
3) Using a loop, calculate how many jumps are needed to cover the total distance. After every jump, the person jumps 1 meter more than the previous jump.
int total, jump;
std::cout << "Enter the total distance required to travel: ";
std::cin >> total;
std::cout << "\nEnter the distance that represents the first jump: ";
std::cin >> jump;
if(jump > total/20)
jump = total/20;
for (int i = 0; jump + i <= total; i++)
std::cout << ""; //Sorry about this but I'm writing it quick
std::cout << "You need " << i << " jumps to cover the total distance entered";
Here you go. Just use the for loop (I haven't tested this so I'm not 100% sure it works, just 99.9%)