Hey! I'm pretty much a newbie when it comes to C programming. I have a problem with lists to solve. I have ideas, I wrote a code. I believe the idea is pretty good but somehow I can't get it to work. I don't get any compile errors, I just get no results and at some point in the execution I get an error that forces me to stop.
I'll try to be short with the requirement of the problem. Kids sit in a circle - one of them starts counting to k -> and this kth person is eliminated. Eventually I have to remain only with one child.
Now...my idea. I placed the names of the kids in a file and in a circular list I simply put numbers from 1 to n representing the kids. I'd remain with one number than I'd take the name of this person from the file. But this last part isn't written yet, only the creation of the list and the game.
typedef struct el
struct el *next ;
void create(adr &bg, adr &end)
if (!bg) bg=crt;
void print_list(adr bg)
void game(unsigned nr, adr &bg)
if (r=bg) bg=bg->next;
printf("\nplease input the information about the files");
printf("\nthe information about a file will be on a line");
printf("\nEnd with CTRL+Z\n");
if (int(ch)==13) n=n+1;
printf("\nPlease chose the number of the child that will start the game: ");