Question: C Programming: //-------------------------------------------------- // Problem #24 // Problem24.c //-------------------------------------------------- #include #include #include #define SHOWCLIMB const int LARGEST_STEPSIZE = 2; //-------------------------------------------------- int main() //-------------------------------------------------- { void

C Programming:

C Programming: //-------------------------------------------------- // Problem #24 // Problem24.c //-------------------------------------------------- #include #include #include

#define SHOWCLIMB const int LARGEST_STEPSIZE = 2; //-------------------------------------------------- int main() //-------------------------------------------------- {

void ClimbNStairs(int climb[],int steps,const int n,int *ways); int n; printf("n? "); while

( scanf("%d",&n) != EOF ) { int *climb = (int *) malloc(sizeof(int)*(n+1));

//--------------------------------------------------

// Problem #24

// Problem24.c

//--------------------------------------------------

#include

#include

#include

#define SHOWCLIMB

const int LARGEST_STEPSIZE = 2;

//--------------------------------------------------

int main()

//--------------------------------------------------

{

void ClimbNStairs(int climb[],int steps,const int n,int *ways);

int n;

printf("n? ");

while ( scanf("%d",&n) != EOF )

{

int *climb = (int *) malloc(sizeof(int)*(n+1));

int ways;

ways = 0;

ClimbNStairs(climb,0,n,&ways);

#ifndef SHOWCLIMB

printf("%10d ways ",ways);

#endif

free(climb);

printf("n? ");

}

system("PAUSE");

return( 0 );

}

//--------------------------------------------------

void ClimbNStairs(int climb[],int steps,const int n,int *ways)

//--------------------------------------------------

{

int LengthOfClimb(const int climb[],const int steps);

if ( LengthOfClimb(climb,steps) == n )

{

(*ways)++;

#ifdef SHOWCLIMB

{

Student provides missing code to display the climb[] using the required format.

}

#endif

}

else

{

int stepSize;

Student provides missing code to consider adding/deleting a 1-stair step to climb,

then adding/deleting a 2-stair step to climb[],..., finally, adding/deleting a

LARGEST_STEPSIZE-stair step to climb[]. You must "sandwich" a recursive call between each

add and delete. Hints Consider the state-space tree that describes the solution space

for this problem. It is only possible to make a stepSize-stair step

when (LengthOfClimb(climb,steps)+stepSize

}

}

//--------------------------------------------------

int LengthOfClimb(const int climb[],const int steps)

//--------------------------------------------------

{

Student provides missing code to compute the quantification

steps

climb[i]

i = 1

}

PLEASE fill in the missing source code in the THREE designated areas in the source file Problem24.c (located below) that says "Student provides missing code..." below. Please also provide a screenshot(s) of the compiled output once complete. I have provided sample ones which should give an idea on how it should look

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!