How to make my car move only by 1 and not by a random number (solved)
See this https://en.m.wikipedia.org/wiki/Conio.h It says that is not part of the standard and also that "most C compilers that target UNIX and Linux do not have this header and do not supply the library functions". So I'm thinking maybe it exists on windows?
If you've made the code yourself, you should know. The only place I see where you're adding to an element of the 'cars' array is line 62. `cars[i] += plus;` As 'plus' holds a random value (assigned in the rands() function), it will move car by a random value. Just change 'plus' to 1 `cars[i] += 1;` Also, having global values is generally not a good idea. Passing the values as arguments or using return values directly is a better idea (mostly) Finally, I hope you know <conio.h> is an obsolete header file from Turbo C, which is not available woth mordern compilers. So I suggest you stop using that
Joshua Codeblocks is not a compiler. It is an IDE. You can check which compiler codeblocks is using. Go to Settings > "Compiler and Debugger". Under the "Selected Compiler" field, you will see the compiler you're using. Also, is your program working when you compiler it in codeblocks? Because <conio.h> shouldn't work unless you're using the Turbo C++ compiler, which I highly doubt will work on your machine.
That's strange. GCC always shows "No such file or directory" when I include <conio.h>.
No, I don't need to. That's actually the correct thing. The <conio.h> header is obsolete. Try running the code on SoloLearn also, it will show error when you include <conio.h>. I'm confused why it is working for you.
Have u tried reinstalling it?
Im using codeblocks is that a good compiler or what
Yes it works. My compiler is gnu gcc
Oh yahh it shows conio.h with an error but i dont know why it works on my laptop