I'm not asking anyone to write the code for me but what I wanna ask is how do I learn this effectively I wanna develop my logic and polish my programming skills I am eager to learn this no matter how hard it is but I need a good place to start
I'm only having difficulty in printing patterns for now.
This involves multiple nested loops.
You will find the problem a lot easier if you use a function like the following:
1 2 3 4 5 6 7
void print_line (int spaces, int stars)
{ for (int i=0; i<spaces; i++)
std::cout << ' ';
for (int (i=0;i<stars; i++)
std::cout << '*';
std::cout << std::endl;
}
Once you have that function in place, you generally need only an outer loop that calls printline() with the appropriate arguments for each line to be printed.
The above function assumes a solid shape. If you want a hollow shape, you will need to adapt it accordingly.
You can analyze the shape for patterns. In this case:
1) There are always 5 characters.
2) The amount of stars is always the same as the row number
3) Amount of spaces = total characters (5) - amount of stars on this row ( row number)
Using that, you can put together the following pseudo code
1 2 3 4 5 6 7
for all lines
while spaces < max lines - line
print a space
while stars < line
print a star
print a newline
end