Title: The various elements of the Pascal triangle are calculated using the recursive calculation process.
Row
01
1 1 1
2 1 2 1
3 1 3) 3 1
4 1 4 6 4 1
5 . . . . . .
col: 0 1 2 3 4
//C + +//Recursive#include <iostream>using namespacestd;
intPascaler (intRow,intCol) {intvalue;if(col>row) {cout<<"Error"<<Endl;}Else if(col==0|| row==Col) {Value=1;}Else{Value= (Pascaler (row-1) (COL)) + (Pascaler (row-1), (col-1)));}returnvalue;}intMain () {introw,col;cin>>row>>Col;cout<<pascaler (Row,col) <<Endl;return 0;} //Iteration#include <iostream>using namespacestd;intPascaliter (intProductintCountintN) {intvalue;intMax_count=N;if(count>max_count) {Value=product;}Else{Value=pascaliter (Count*product), (count+1), max_count);}returnvalue;}intPASCALCLCU (intRowintCol) {intValuex;valuex= (Pascaliter (1,1, row)/((Pascaliter (1,1, col)) * (Pascaliter (1,1, (row-Col )));returnValuex;}intMain () {introw,col;cin>>row>>Col;cout<<PASCALCLCU (Row,col) <<Endl;return 0;}
Sicp~ the construction and interpretation of computer programs ~ 1.12 C + + implementation