Hi,
This is small c++ guess game, I almost finished it, but when i tried compile it gave me an error: "Cannot open include file: 'stdlib': No such file or directory"
is this file part of c++ standard library..? why compiler can't find it?

here is my .cpp source:

stdlib.h you forgot the .h :]

is stdlib a header, or do you use cstdlib?

Thanks FrozenSnake, code worked well ..
what is header conio.h, is it important in c++ 2008 express

Thanks FrozenSnake, code worked well ..
what is header conio.h, is it important in c++ 2008 express

I have never used conio.h in any IDE's I used. If you want to read about it you can read here:
http://en.wikipedia.org/wiki/Conio.h

Hi,
This is small c++ guess game, I almost finished it, but when i tried compile it gave me an error: "Cannot open include file: 'stdlib': No such file or directory"
is this file part of c++ standard library..? why compiler can't find it?

here is my .cpp source:

Ok lets fix the first issue, in order to get stdlib to work add a .h to the end of it (i.e. #include <stdlib.h>)

Secondly your formatting is horrible. Your cout's are all done incorrectly, you have functions that are inproper such as line 51: that is an invalid line of code, as is line 19 and line 22 (well the { is valid, the clrscr() is not (nor is it necessary).

Lastly aside from sentence structures, your last while statement is improper, first change the char ans to string ans (don't forget to add the string header to the top), and then the while statement should be (ans == "y" || ans == "Y"). Also you need to add this line to your if(chances==totchan) call:
guess = number;

Otherwise if you keep guessing the wrong number the game will continue playing until you get the number correct. This way if you still miss it, the game will end correctly and allow you to either exit or try again.

After removing the bad parts and fixing the cout structures I was able to compile and run your program.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.