Exercise 1.3
Define a procedure thats three numbers as argument and return the sum of the square of both large number.
Scheme implementation
( define (square x) (* x x)) (define (Sum_of_square x y) (+ (square x) ( square y)) ( Define (bigger x y ) (if (> x y) x y)) (define (smaller x y) (if ( < x y) x y) (define (Sum_square x y z) ( sum_of_square (bigger x y) (bigger (smaller x y) z)) c19/>
C Language Implementation
//some exercises of SCIP (computer program construction and interpretation) are implemented in C language. Compare and further understand the functional thinking of scheme//Define A procedure thats three numbers as argument and return the sum of the square of the large//numbers.//C Language Implementation#include"stdafx.h"#include<iostream>using namespacestd;intSquareintx);intSum_of_square (intAintb);intBigger_num (intAintb);intTwo_more_bigger_sum_of_square (intAintBintc);intSmaller_num (intAintb);//Check the CodeintMain () {cout<<two_more_bigger_sum_of_square (1,2,3); return 0;}intSquareintx) {returnx*x;}//Retun The sum of the num of squareintSum_of_square (intAintb) {returnSquare (a) +Square (b);}//return the bigger numintBigger_num (intAintb) {if(A >b)returnA; Else returnb;}//takes the both Num as agrument and return the smaller numintSmaller_num (intAintb) {//return the bigger num if(A >b)returnb; Else returnA;}
Scip Exercises (1) Comparison of scheme and C implementations