I am a beginner with C++.
I'm trying to create a loop with std::size_t
, but I'm not sure if I'm using it correctly. The variable (i
) should start at 1
and iterate which i <= 10000
. Each time it iterates, i
should be multiplied by 10.
Therefore, the values should be 1
, 10
, 100
, 1000
, 10000
However, I am getting 10
, 110
, 1110
, 11110
int main()
{
for (std::size_t i = 1; i <= 10000; i += 1)
{
i *= 10;
std::cout << i << " \n";
}
}