Display a Triangle in C++ Assignment Sample
Write a program that displays a right-angled triangle using * character. It should look like
*
**
***
****
*****
This is an incredibly basic C++ programming assignment, we can help with far more advanced ones as well.
Solution:
triangle.cpp
#include
using namespace std;
int main(int agrc, char* agrv[])
{
// Declare the variable
int i, j;
i = j = 0;
// Code need to test
for (i = 1; i <= 5; i++)
{
for (j = 1; j <= i; j++)
cout << “*”;
cout << endl;
}
return 0;
}