Welcome to the Ranch
So, you want to print
That is a common problem, and the solution is similar both in C++ and Java®. Remove the choice about which symbol to print; that is getting in your way. When you get the rhombus printed, then you can put the choice back.
You should move most of that code out of the main function. Just as in Java®, that is intended for starting the application, not for the whole application. I suggest the following stages might help:-
1: Set up a loop to print 1 2 3 4 52: Enhance that loop to run from 1...n3: Enhance that loop to print 1 3 5 7...n4: Enhance the loop to print 1 3 5 7...n...7 5 3 1Hints:-
1: The loop will run from 1 to 2
n − 1. But maybe not 2
n − 1 iterations.
2: You can create max and min functions, if they are not already available and work out how many to print with subtraction.
5: Create a loop to print n - 1...4 3 2 1 0 1 2 3 4...n - 16: Put the two loops together to print 4 1, 3 3, 2 5, 1 7, 0 9, 1 7, 2 5, 3 3, 4 17: Work out which of those numbers means spaces and which means print a symbolThis is how I would write min in C; max is very similar:-
Note: the height and width of a rhombus are the same.