I'm back again, thanks for the help last time cplusplus. This little code has me stumped.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
int i,j,n=0,odd_number;
cout << "Enter only a Odd number: " <<endl;
cin>>odd_number;
if (odd_number % 2 == 1)
for(i = 0; i < odd_number; i++)
{
for(j = i; j > 0; j--)
cout<<" "; // displays the space before +
for(j = i; j < odd_number - i ; j++)
cout<<"+"; // displays the +
cout<<"\n";
}
else
{
cout << "You did not enter a Odd number!"<<endl;
}
Gives me this. But I need to flip the pyramid so that it starts with 1 + on top and ends with <user input> on bottom; in this case 11
Enter only a Odd number:
11
+++++++++++
+++++++++
+++++++
+++++
+++
+
Press any key to continue . . .