#include <iostream>
int main()
{
constint i_max = 256;
double i_step = 2.0;
for (int i = 1; i >= 1; i = i * i_step)
{
std::cout << i << ' ';
if (i == i_max) i_step = 0.5;
}
std::cin.get();
}
One problem is that you're printing the same variable all the time. The output is restarting from 1 on each line. Notice that you do have a variable which starts from 1 for every line - k.
Now, about the shape, the most simple solution would be to first print
1
12
123
and then in another set of loops
12
1
to print a backwards triangle, simply change the outer loop to one that does -- instead of ++.