5-23 C++ Display Triangle Patterns With Nested Loops

Starting With C++: From Control Structures to Objects
Programming Challenge 5-23: Displaying Triangle Pattern With Nested Loops

Write a program that uses a loop to display patterns below:

+
++
+++
++++
+++++
++++++
+++++++
++++++++
+++++++++
++++++++++

++++++++++
+++++++++
++++++++
+++++++
++++++
+++++
++++
+++
++
+

Learning to code? Follow my C++ tutorials for beginners. I do a lot of C++ programming challenges and C++ projects as part of my homework – every day!
If you are learning to program, nothing beats solving real programming exercises and coding challenges.
So don’t forget to subscribe, as I release new programming videos every day!

DOWNLOAD SOURCE CODE: http://www.codinghomework.com/?p=441

Comments

Killerxsel xd says:

this pattern? plz

1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

Zaur Melikov says:

Very helpful, thank you.

Florvin Jay Roxas says:

Thanks Man! I wish you do more videos about C++.

ali baba says:

can i make this
+ +
++ ++
+++ +++
+++++++ +++++
if yes plzz send me source code

Keep moving forward says:

#include
#include
#include

#include
#include

using namespace std;

int main() {
int i, j;
string p, p2;

for(i = 0; i < 10; i++){ p.append(1, '+'); cout << p << endl; if(i == 9){ cout << endl << endl; for(j = 10; j > 0; j–){
p2.assign(p, 0, j);
cout << p2 << endl; } } } return 0; }

Jeremy Koutroubas says:

dear god thank you

Aljhebae says:

Hi! Pls reply to me cos i just want to ask something.
My professor is asking us to make a program which can be any languages and the program must execute either of the four loop testing techniques. Can u give me a tip what to do or can u give me an example plsssssss.

parris compwiz says:

For the second loop int c = 0; c

Kuryusai 18tokki says:

how to make this
+
++
+++
++++
+++
++
+
the height depends on the input number of the user(height is the number of the first column)

sherry Yu says:

how to code
#o#o#o#
#o#o#oo
#o#o###
#o#oooo
#o#####
#oooooo
#######

Arlette Casano says:

Omg thanks you very much! 😀

Tiago Novaes says:

Many thanks, bro. Helped me a lot. Thanks.
.
Muito obrigado mano. Me ajudou muito. Valeu.

Antim Rudra says:

What if i had to print something like:
*
* *
* *
*************

This pattern? Can we help me with that?

santhosh gorla says:

thank you

ROYCE 415 says:

Great vid, helped out with my homework. Thanks

irshad ali says:

Very nice lecture.

Filip Laco says:

Can you write me code for following pattern:

Insert uppercase character:E
E D C B A B C D E
D C B A B C D
C B A B C
B A B
A

If you want, you can e-mail mi solution on:
filip.ciller@gmail.com

Thank you

Engineer Thileban Explains says:

column part is confusing.

eno says:

thanks for this!

Gaurav Singh says:

How to display
***
**
*
**
***
In c++

Nasiha Nasim says:

which c++ compiler is this?…i have a dosbox c++ compiler which may have a different way of programming, this didnt work so well….

NeStoPinGeZ says:

i think i did the same as you but i got infinite loop do you know why ??
thanks 🙂

J Ferro says:

THANK YOU SO MUCH

Dylan Messer says:

What about this pattern?

/ /
|`\_,–=”=–,_//`|
.” :’. .’: “. /
==) _ : ‘ : _ (==
|>/O _ /O< | | -"~` _ `~"-/ | >|`===. _/ .===`|< .-"-. ===' | '===/ .-"-. .-----{'. '`}---, .-'-. ,/---{.'. '}-----. | `"---"` `~-===-~` `"---"` | | .-------------------------------. | | | | | | | | | | | .--. | | | | ." o __ | | | | _.-" ,( ` | | | | _.-" ,;;| | | | | _.-=" _," ,,;;;' | | | | .-"`_.-"``-..,,;;;;:' | |' | | `"'` `` | |.'` | | /^\ | |'.'`} | | | } '. } | | | /.'`./ | '-------------------------------' /. './ _| _ /.`'./ (.-/.)--------.__________________.-------{.'. { 6 6/ / `.'` ( = /= ______/....................______ .'. /O | | }'.'} ) / | [[[[[[[[[[ === () () () | {'.'/ ( U U | ________ | `~` (| |)| [[[[[[[[[[ === [________] | _w___w_:----------------------------------:_______ | [] [][][][] [][][][] [][][][] [][][] == ===== | | | | [][][][][][][][][][][][][][]_ [][][] [][][][] | | [_][][][][][][][][][][][][]| |[][][] [][][]|| | | [] [][][][][][][][][][][][__| [][][]|| | | [__] [][][][][][][][][][][___] [] [][][]|| | | [_] [_][_____________][_] [_][][][] [__][]|| | '--------------------------------------------------'

 Write a comment

*

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!