1234567891011121314151617181920212223
int main() { int b=10; for (int r=1; r<=5; r++) { for(int space=1; space<b; space++) { cout<<" "; } for(int c=0; c<2*r-1; c++) /*here when i use c+1 instead of c++, it starts an infinite loop. */ { cout<<"*"; } b--; cout<<endl; } return 0; }
c = c+1
c+1