pascal triangle in c++

Sample code for draw pascal triangle in c++ #include using namespace std; main() { int i,j,k,l; for(i=1;i<=6;i++){ for(j=1;j<=12;j++){ if(j>=6-i && j<=4+i){ cout<<“*”;} else{ cout<<” “;} } cout<<“\n”; } } output:

c++

constructor in c++

To initialize an object while creating it we need a constructor , we have sample program of constructor given below. Simple program using constructor in c++ #include using namespace std; class A{ public: A(int a,int b){ int c=a+b; cout<<“sum : “<<c; } }; int main(){ A obj(2,3); return 0; } Continue Reading