But what I need now is to make something that looks like this, and I was not able to find it through searching. All the other 'trees' that people have made look different:
*
**
***
****
**
***
****
*****
***
It's supposed to be "half of a pine tree". I'm very new to C++, could I get some help?
That code works for the pattern of the tree, but I need it to match the style of the code I initially posted. I need to ask the user for a height, and then output stars based on the conditions of the two for loops, and the pattern needs to be correct no matter what height the user gives me.
Right now I have this:
1 2 3 4 5 6 7 8 9 10
}elseif(shape == 7){
cout <<"\nHeight?: ";
cin >> height;
for(int a = 0;a < height;a++){
for(int b = 0;b < (a % 4) + (a / 4);b++){
cout << "*";
}
cout << "\n";
}
cout << endl << endl;
Which ALMOST worked, but the pattern is slightly off. Could I have some help fixing it? I've been changing it around trying to get it right, but everything I've tried hasn't worked.