write a programm which out put is a triangle
example
5
4 4
3 3 3
2 2 2 2
1 1 1 1 1

Give it a shot and see how it goes.

Actually, here is the code. Your teacher will be impressed! =)

``````#include<iostream>
#include<windows.h>
#include<iomanip>
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string>
using namespace std;
int p[3]={0,0,2};
string doit[8] = {"Plea","se ente","r th", "e siz", "e o", "f yo", "ur tria","ngle: "};
void endit()
{
cout << endl;
}
void top()
{
for(p[0];p[0]<p[1]/p[3];p[0]++)
{
for(int r=0;r<=p[0];r++)
cout << p[1]-p[0];
endit();
}
}
void questionthoseguys()
{
cout << doit[0] << doit[1] << doit[2] << doit[3] << doit[4] << doit[5] << doit[6] << doit[7] << doit[8];
cin >> p[1];
}
void bottom()
{
for(p[0]=p[1]/p[3];p[0]<p[1];p[0]++)
{
for(int r=0;r<=p[0];r++)
cout << p[1]-p[0];
endit();
}
}
void main()
{
questionthoseguys();
system("cls");
endit();
top();
bottom();
endit();
}``````

....

Actually, here is the code. Your teacher will be impressed! =)
<snipped>

I beg to differ. Please, if you are going to blatantly give the answer
out, at least give a good answer. Not trying to be rude, just telling
the truth.

I beg to differ. Please, if you are going to blatantly give the answer
out, at least give a good answer. Not trying to be rude, just telling
the truth.

You quite obviously didn't get the point of the post. If you looked at the thread description, and what was required you would most likely realize that this is indeed a beginner's assignment, so the OP would have no clue what an array/function/string is, and this is why I gave him that answer.