Hey yall, this is part of a big assignment I have coming up and this part has put my progress at a dead stop.
The question itself is: "Create an integer var9 and set it to 100. Create a loop structure where var9 counts down the iterations by halving the counter each time. The moment that it reaches 0 or less, it exits. Print the values of var9 with each pass."
This code is crucial for the next part of the assignment as well.
I attached what code I came up with, and while it does sorta-kinda work, I know there is a better way. Thanks in advance
#include <iostream>
int main()
{
// Create an integer var9 and set it to 100.
auto var9 = 100;
//Create a loop structure where var9 counts
// down the iterations by halving the counter each time.
do
{
//Print the values of var9 with each pass.
std::cout << var9 << '\n';
}while ((var9 /= 2) > 0); //The moment that it reaches 0 or less, it exits
return 0;
}