C++ Program to Print Alphabet Triangle

Posted poission

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C++ Program to Print Alphabet Triangle相关的知识,希望对你有一定的参考价值。

There are different triangles that can be printed.

Triangles can be generated by alphabets or numbers.

In this C++ program, we are going to print alphabet triangles.

Let‘s see the C++ example to print alphabet triangle.

 

#include<iostream>

using namespace std;


int main() {
char ch=‘Z‘;
int i, j,k,m;
for (i=1;i<=5;i++) {

for(j=5;j>=i;j--)
cout<<" ";
for (k=1;k<=i;k++)
cout<<ch++;
ch--;
for(m=1;m<i;m++)
cout<<--ch;
cout<<"\n";
ch=‘A‘;
}
return 0;
}

 

 

xfer from  https://www.javatpoint.com/cpp-program-to-print-alphabet-triangle

以上是关于C++ Program to Print Alphabet Triangle的主要内容,如果未能解决你的问题,请参考以下文章

C++ fmt::print 与 fmt::format_to 命名的技术背景?

Program to Convert Binary to Decimal

Java Program to Calculate Standard Deviation

Java Program to Calculate Standard Deviation

How to use Xhorse Mini OBD Tool to Program 2020 Kia Sportage Key?

The Better Way to Debug Your JavaScript Program