Recommend some books??

Pages: 12
Hey, I'm new here and fairly new to programming :/ I want to invest in one or two C++ books, can anyone recommend some? I have little to no experience in programming :( unfortunately. However I have created a very small cmd game where you need to guess the number between 0 and 1000 so that's about it

Any recommendations will be appreciated :)
Thanks in advance
The most reliable current book list for C++ is at http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list

For people with "little to no experience in programming", the recommended book is usually Stroustrup's "Programming: Principles and Practice using C++"
I found really useful "C++ Templates - The Complete Guide" but it only covers advanced concepts. Shows the real power of C++.
can i see the game?xD
Wow Thanks for the help :P didn't expect to get replies this quick :)

can i see the game?xD

errr... maybe

wow this is gonna be embarrassing :P

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    int iGuess;
    int iUserguess;
    int iGuesses = 0;
    
    while(true)
    {
               system("CLS");
               cin.clear();
               iGuesses = 0;
               
    srand(static_cast<unsigned int>(time(0)));
    iGuess = rand()%1000+1;
    cout << "Welcome to the Guessing Game!\nWhat number am I thinking of? Between 0 and 1000 :) Good luck!"
         << endl;
    do
    {
    cout << "Enter your guess: "; 
    cin >> iUserguess;
    if(iUserguess > iGuess)
    {
                    cout << "To High!" << endl << endl;
    }
    if(iUserguess < iGuess)
    {
                    cout << "To Low!" << endl << endl;
    }
                    
    iGuesses ++;
    }while(iUserguess > iGuesses || iUserguess < iGuesses);
    cout << "You guessed the right number Well done!" <<endl << endl;
    cout << "It took you " << iGuesses << " Guesses " << endl << endl;
    system("PAUSE");
    }
return 0;
}



I have had a little problem with this... I'm sure to a lot of you this will be easy, but I can't figure out what's wrong with it... Please can you have a look?
And PLEASE remember this is my first program :/
Last edited on
What is the problem you are having?
When I find the number nothing happens... just tells me to enter the number over and over again :/
}while(iUserguess > iGuesses || iUserguess < iGuesses);
Shouldn't it be (iUserguess > iGuess || iUserguess < iGuess) ??
Yep :)
lol I can't believe I didn't see that :( -facepalm-

Thanks :) it's working great now :P
Last edited on
I like Dawons's C++ Through Game Programming. The game programming is really simple so don't expect to come up with Minecraft from that book, but it's one of the few (if only) out of many I've tried that I've stuck with so far on my C++ n00b quest =) $20 or so around the web.
Oh yeah,,, I'm not expecting to make something as on a huge scale. I'm proud of that shitty guessing game :P I just think this is something I want to learn and perhaps follow in the future :)
Anyways, in case you get some errors, you should use code tags, not output tags, when you post code.
First you select the code, then you press the '<>' button.

Thanks for having used, at least, the output tags.

Also take a look at these, they may become useful for you:

http://www.cplusplus.com/articles/z13hAqkS/
http://www.cplusplus.com/forum/articles/11153/
http://www.cplusplus.com/articles/4z18T05o/
My 3 recomendations if you are new to C++

* 1 - This is probeboly the best of them from when i was lerning the basics.
Beginning Programming with C++ for Dummies by Stephen R. Davis (Great Book Comes with "Live CD" with courses and sources on the CD\DVD with compiler also)

* 2 - Effective C++ Third Edition 55 Specific Ways yo Improve Your Programs and Design by Scott Myers (Absolutely worth reading!)

*3 - Effective STL 50 Specific Ways to Improve Your Use of The Standard Template Library (It sorta goes together with the one above).

Hope it helps and am not impling your stupid am impling am a bit stupid :p hehe
Happy Holidays and a Happy New Year!
has anybody even saw the System("pause") at the end of the guessing game?i wonder why no one corrected it

anyway @Bandypoof dont use System("pause") use cin.get() instead
Has anybody even clicked on those links at the end of my previous post? I wonder why no one did
anyway @dumb0t click on those links, thanks

[/Sarcasm]
@EssGeEich oh sorry, i haven't seen your links... i wonder why is that
maybe because i hate links, or i have a traumatic experience of them damn links...well u wouldn't know that cause i never told anyone about it
I was just being sarcastic, lol.
Anyways, to not-getting-this-post-reported, I'll list my last books i've read:

Addison Wesley - Efficient C++ Programming Techniques
David Vandevoorde/Nicolai M Josuttis - C++ Templates The Complete Guide
Sharam Hekmat - C++ Essentials
Scott Meyers - Effective C++
Scott Meyers - More Effective C++
Andrei Alexandrescu - Modern C++ Design
Herb Sutter - More Exceptional C++
Bruce Eckel - Thinking in C++
Thanks for the suggestions everyone :) I really appreciate it.

Last edited on
"Object Oriented Thought Process". Not really a C++ book, but it helped learn how OO works.
Pages: 12