First thing I see on quick glance is you need an endline command at the end of the for loop.
jasweb2002
Junior Poster in Training
56 posts since Sep 2004
Reputation Points: 11
Solved Threads: 2
Oh yeah, also your b and c variables are only initialized to work the first time through. After the first run b and c are equal to zero and therefore those two nested for loops will do nothing. I am heading off to class so I can't fix the problem for you right now but that is whats going to wrong. You need to find a way to reinitialize b and c for every pass through.
jasweb2002
Junior Poster in Training
56 posts since Sep 2004
Reputation Points: 11
Solved Threads: 2
Just Extreme's code a little tidied up for Dev C++
Hope you can see the flow of things.
// Dev C++ code
#include <iostream>
using namespace std;
int main()
{
int k, m;
for(k = 1; k <= 10; k++)
{
// outputs 1,2,3,...,10 stars
for(m = 0; m < k; m++)
cout << "*";
// end each inner loop with a new line
cout << endl;
}
cin.get(); // wait
return 0;
}
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
So you don't need to use cout << " "; as you originally stated?
jasweb2002
Junior Poster in Training
56 posts since Sep 2004
Reputation Points: 11
Solved Threads: 2