for (i = 11; i >= 1; i--)
{
for (j = 1; j <= i; j++)
cout << "*";
cout << endl;
}
thats my code but i need the pyramid to go down to the right not to the left
how do i fix it?
Swap some numbers around, I'm sure you'll figure it out if you just think ;)
Or you could just type:
cout << " ** \n";
cout << " * * \n";
cout << " * * \n";
cout << " * * \n";
cout << " ***** \n";
but why would you do it the easy way?
I'll try to help anyway.
Don't use this, but it's fun to see what it does:
#include <iostream>
using namespace std;
int main() {
for (int i = 1; i <= 11; i++)
{
for (int j = 11; j <= i; j--)
cout << "*";
cout << endl;
}
cin.get();
return 0;
}
Well this gives you a nice little box:
#include <iostream>
using namespace std;
int main() {
for (int i=11; i>1; i--) {
for (int j=1; j<11; j++)
cout << "*";
cout << endl;
}
cin.get();
return 0;
}
As for a triangle, what do I look like? Shiva?
Sorry I couldn't be more helpful.
Last edited on