chconline Veteran Posted September 18, 2009 Veteran Share Posted September 18, 2009 I can't seem to get this straight haha. Programming has never been my forte, and this should be pretty easy for most of you :p I need the output to be like this: ********* ******* ***** *** * It starts with one * at the bottom and increases by 2 subsequently. Here's what I got: #include <iostream> using namespace std; int main() { int j=1; for (int i=5;i>=1;i--) { for (int k=1;k<=j;k++) { cout << " "; } for (int x=1;x<=i;x++) { cout << " *"; } cout <<endl; j++; } system("Pause"); } It increases by 1 star rather than 2, but I can only get it centered right this way... any ideas? Thanks! Link to comment Share on other sites More sharing options...
0 chconline Veteran Posted September 18, 2009 Author Veteran Share Posted September 18, 2009 Never mind I got it. :D Link to comment Share on other sites More sharing options...
Question
chconline Veteran
I can't seem to get this straight haha. Programming has never been my forte, and this should be pretty easy for most of you :p
I need the output to be like this:
It starts with one * at the bottom and increases by 2 subsequently.
Here's what I got:
#include <iostream> using namespace std; int main() { int j=1; for (int i=5;i>=1;i--) { for (int k=1;k<=j;k++) { cout << " "; } for (int x=1;x<=i;x++) { cout << " *"; } cout <<endl; j++; } system("Pause"); }It increases by 1 star rather than 2, but I can only get it centered right this way... any ideas?
Thanks!
Link to comment
Share on other sites
1 answer to this question
Recommended Posts