I have an assignment to complete in c language -- 2

Suljettu Julkaistu 4 vuotta sitten Maksettu toimituksen yhteydessä
Suljettu Maksettu toimituksen yhteydessä

a person is standing on feld[0] and has to make it to the end(feld[20])

the rules are

either forward those many steps the box has value((*s).feld[x])

or backward whole number of the half of the value

at last it should either return 0 or 1

0 being cannot be solved

1 being can be solved

this is the c file

#include

#include

#include "testat-7.h"

int huepfspiel(spielfeld * s, int nr);

int huepfspiel(spielfeld * s, int nr){

int rc = 0;

static int aufrufe;

int k;

++aufrufe;

printf("%d", aufrufe);

if(nr == 20)

rc = 1;

if(nr != 20 && aufrufe < 4000){

for(k=0; k<=1; k++){

if(k == 1 && (nr + (*s).feld[nr] = 0)){

nr = (nr - (((*s).feld[nr])/2));

rc = huepfspiel(&s, nr);

if(rc == 1)

break;

}

}

// ...

}

return rc;

}

int main() {

spielfeld s = {20, {5,3,2,1,7,5,1,2,3,4,5,1,3,7,1,5,1,9,0,1}};

//printf("%d", [login to view URL][20]);

printf("Loesbar: %d\n", huepfspiel(&s, 0));

return 0;

}

-----------------------------------------------------------

and this is the header file

#ifndef _TESTAT_7_H

#define _TESTAT_7_H

typedef struct {

int n; // Feldgroesse

int feld[20]; // Spielfeld

} spielfeld;

#endif

Algoritmi C-ohjelmointi C# -ohjelmointi C++ -ohjelmointi Tietojärjestelmäarkkitehtuuri

Projektin tunnus: #23622566

Tietoa projektista

9 ehdotusta Etäprojekti Aktiivinen 4 vuotta sitten

9 freelanceria on tarjonnut keskimäärin ₹1094 tähän työhön

idleswell

Hello, I have 30 years experience programming in C. You have posted some C code. What do you require from me? A milestone payment for the full budget for this project must be deposited with this site before your offe Lisää

₹1200 INR 7 päivässä
(185 arvostelua)
6.2
atul0x60

pm me. I solved it.

₹800 INR 1 päivässä
(9 arvostelua)
2.9
ecofriendlygeek

Hello , I have made a solution based on the code you have uploaded. I can share with you if you award me the bid. Please discuss on chat. Thanks.

₹1500 INR 1 päivässä
(1 arvostelu)
1.1
shbhmsxn4

I will work on the program, it seems pretty straightforward. I plan on using backtracking algorithm to find the solution. I have immense experience with c/c++.

₹1750 INR 1 päivässä
(0 arvostelua)
0.0
Aqilkhan3032

Sir i am the student of me and engineering and i have studied C++ one of my subject i will complete your task in less timee please hire me

₹600 INR 7 päivässä
(0 arvostelua)
0.0
harsh307shuklaaa

Solved this question however,I posses required skills and desire to work on this project which makes me different from crowd.I would love to be part of this project and use and enhance my skills.

₹1050 INR 7 päivässä
(0 arvostelua)
0.0