crowleyhammer

Members
  • Content count

    13
  • Joined

  • Last visited

Community Reputation

127 Neutral

About crowleyhammer

  • Rank
    Member
  1. need some help with enumerations and code

    Cheers for that mate, going back a bit and making sure that ive understtod everything up to this point and giving it another go as per you advice. Your answer really helped!
  2. Hi Im using Beginning C++ Game programming by Michael Dawnson and having reached chapter two my exercises were to Rewrite a program using an enumeration and to write a new version of a guess my number game. With the guess my number game i have to create it so that the computer tries to guess my number, i have done that and got the computer guessing but i am having trouble in telling the computer that its guess is higher or lower than my number. #include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main() { int number; int tries = 0, guess; cout << "\tWelcom to Guess My Number VS the computer!\n\n"; cout << "Please select a number between 1 and 100 "; cin >> number; char again = 'n'; while (again == 'n') { srand(time(0)); int guess = rand() % 100 + 1; cout << guess; cout << "\nIs this your number? (y/n)"; cin >> again; ++tries; enum highlow {HIGH = 1, LOW = 2}; cout << "Higher or Lower?"; cin >> highlow; if (highlow = 1) int guess = rand() % guess - 1; if (highlow = 2) int guess = rand() % guess + 1; } cout << "\nYes i won!" << tries << " guesses!\n"; system("PAUSE"); return 0; } I know the code wont compile but im banging my head against a brick wall here and i think the reason is because i dont understand how to use enumerations properly. id be gratefull for any help.
  3. The Firm: Would you buy this?

    oh and 1 more thing you have to and i mean "HAVE TO" be able to throw plastic chairs at the police, ITS THE LAW!!!!!! Also you could get drunk,remeber fable where yo got drunk? that should be implemented somehow, you could have a preliminary round that during the actual football match you have to wind the opposition up as much as possible, the more you wind up the more turn up to the fight after!!! i could think of ideas all day love it!!!!!!
  4. The Firm: Would you buy this?

    In your game can i be my beloved west hams ICF and smash the F&%k out of the yid army? or at least have it large down millwalls new den,can i at least smash up shite heart lane? good luck getting the licesnse to use real teams tho, altho you could do a pro evo editior :D Now when millwall and west ham clashed in 92 i dont remember buying any weapons lol but i like the idea of it,gotta get back to work will look over it more later. p.s there is a game called hooligans which is like a real time stratergy game that has this,it a budget title look on play.com. much regards.
  5. The Definitive Guide to Language Selection

    maybe, just maybe this will help beginners more. http://www.gpwiki.org/index.php/Picking_a_Language
  6. help with a program

    ok i need help working out how to tell the computer its too high or too low, thanks in advance #include <cstdlib> #include <ctime> using namespace std; int main() { int number; int tries = 0, guess; cout << "\tWelcom to Guess My Number VS the computer!\n\n"; cout << "Please select a number "; cin >> number; char again = 'n'; while (again == 'n') { srand(time(0)); int guess = rand() % 100 + 1; cout << guess; cout << "\nIs this your number? (y/n)"; cin >> again; ++tries; } cout << "\nYes i won!" << tries << " guesses!\n"; system("PAUSE"); return 0; }
  7. help with a program

    well so far i have the computer guessing my number and and me being able to tell it if its right or not,all i need to do is track its guesses and also tell it whether to be higher or lower,the tracking should not be a problem,but how do i go about telling it higher or lower?
  8. help with a program

    i was thinking that,but i thought it will generate numbers too high,but of course you can set the largest number it can generate a random number from. thanks for your help.
  9. help with a program

    ok im using Dev-C++ and ive just created a guess the number game,i now need to find a way to allow the player to pick a number and the computer to guess it, if someone could post the code w/o telling me why it works that would be more helpfull because working it out will be more educational for me,thanks for your time.
  10. Programming and Lack of Focus

    demus79 how good would you say you are at programming now? and how long have you done it,i was just wondering because i like your method but i was just wondering what you are now able to do with your skills.
  11. Programming and Lack of Focus

    http://www.amazon.co.uk/o/ASIN/1592002056/ref=s9_asin_image_1/026-2323224-2321226 i think this book is very good for learning c++ because it helps you to program a game as you learn what functions etc etc do,this keeps me interested more than just reading "this is a fuction" with no example or reason of why or how to use it other than on its own,most books tell you how to create one but very few tell you why you implement it,either that or they lose you in jargon it doesnt explain very well.