Consider the algorithm you need to apply to achieve this. Express the steps in natural language first, to get it straight in your mind. When you think you have that sorted, try coding the steps. If you can't get your code to work, post it here.
You know you need a main() function. You know you need a loop of some kind. You know that inside the loop you need some form of output statement.
If you look at the desired output, some lines have different characteristics from others, so you need to cater for this in your output statement(s).
Try to make a general formula for printing 'spaces' and '&'.
For example :
The number of spaces that are to be printed in 1st line (outside the triangle) is one less than the number of lines given by user. It decreases by 1 as we move from one line to another.
Divide your task, which means, keep one loop that increments line, one that prints spaces outside the triangle, one that prints inside the triangle, and one that prints &
Also here is a hint : Try to print last line separately, that is outside loops that prints the upper part ( in your example, lines (1 - 4) means upper part, so lines (1 - 4) and 5 to be done separately ).
The rest of the world may not use the same compiler and OS as you do. Both conio.h and windows.h are dependent on the implementation. Further, this problem can be solved without resorting to non-portable libraries. You don't have to call gotoxy() when it's a simple matter of printing a few space characters.
I am working creating a fully encapsulated, homogeneous singly linked data structure. The Listing class and SinglyLinkedList class that are part of the whole application compile fine, but the problem ...