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

Lukket Lagt ut 4 år siden Betales ved levering
Lukket Betales ved levering

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

Algoritme C-programmering C# Programmering C++ Programmering Programvarearkitektur

Prosjekt-ID: #23622566

Om prosjektet

9 bud Eksternt prosjekt Aktiv 4 år siden

9 frilansere byr i gjennomsnitt ₹1094 for denne jobben

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 Mer

₹1200 INR på 7 dager
(185 Omtaler)
6.2
atul0x60

pm me. I solved it.

₹800 INR på 1 dag
(9 Omtaler)
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 på 1 dag
(1 anmeldelse)
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 på 1 dag
(0 Omtaler)
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 på 7 dager
(0 Omtaler)
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 på 7 dager
(0 Omtaler)
0.0