Check out my code on Pascal's triangle using C++.

```
#include "stdafx.h"
#include <iostream>
using namespace std;
int pascals(int,int);
int fact(int);
int main()
{
int r,e,levels,space;
cout<<"Enter the number of lines needed";cin>>levels;
space = levels+1;
for(r=0;r<=levels;r++)
{
//
std::cout.width(space);//shape
for(e=0;e<r+1;e++)
{
cout<<pascals(r,e)<<" ";
}
cout<<endl;
space--;//shape
}
cout<<endl;
cin>>r;
return 0;
}
int pascals(int r,int e)
{
int temp;
temp = fact(r) /(fact(e) * fact(r-e));
return temp;
}
int fact(int num)
{
int temp;
if (num <=1)
return 1;
else
{
temp = num * fact(num -1);
}
return temp;
}
```