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

Închis Postat la acum 4 ani S-au achitat serviciile după ce au fost prestate
Închis S-au achitat serviciile după ce au fost prestate

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

Algoritm Programare C Programare C# Programare C++ Arhitectură software

ID Proiect: #23622566

Detalii despre proiect

9 propuneri Proiect la distanță Activ acum 4 ani

9 freelanceri plasează o ofertă medie de 1094₹ pentru proiect

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 Mai multe

₹1200 INR în 7 zile
(185 recenzii)
6.2
atul0x60

pm me. I solved it.

₹800 INR în 1 zi
(9 recenzii)
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 în 1 zi
(1 părere)
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 în 1 zi
(0 recenzii)
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 în 7 zile
(0 recenzii)
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 în 7 zile
(0 recenzii)
0.0