Added: 3 years ago
From: antiRTFM
Views: 28,464
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (112)

Sign In or Sign Up now to post a comment!
  • why do I get this syntax error: missing ";" before 'cout' ? checked my code agian and again and its the same as yours! Also if I start debugging it says: not equal! (from the last topic).

  • 3:50-3:55"The best way to understand these operators is to sit down and test it out for yourself..."

    Mannnn... do you think I'm standing up watching 60+ 10 min C++ do-it-yourself youtube videos standing up????

  • Ty so much for these videos, This way of learning is more fast and efficient.

  • '-'

  • Comment removed

  • it says that 'playersGuess' is an 'undeclared identifier'?

    help

  • Guess: I hope the next video lesson is about simple looping. :D

  • Heh, those semicolons are important. I accidentally put one on the last if statement and found that even when I guessed the number right it would include that additional statement on the next line.

    I know about system("pause>nul"); but does anyone know how to keep the window open for more guesses?

  • Hey, i've encountered a small problem and am not sure what to do.

    I'm using Dev-C++ and when i try and do say:

    if ( playersGuess == theNumber)

    else

    if ( playersGuess > theNumber)

    It wont accept the bare else after the if. the compiler just says:

    "expected primary-expression before "else"

    please help!

  • @cuz207 Hey there friend I believe I see your problem ,sorry for late response. You haven't told it what to do if the playerGuess == theNumber, perhaps cout << "Winner";

    There other problem is that it needs a semicolon at the end of the if statement

  • When I type:

    int a = 5;

    int b = 6; if (a = b) cout << "they are equal";

    It writes the line "They are equal"? I probably sound like a complete "n00b" but I'd appreciate the help.

  • @MyJizzHasFizz you have to say if (a==b) because otherwise you are setting a equal to b when you say a=b

  • i don't get the need for the bool

  • 7:57

    magic happens :D

  • I have done the char k; cin >> k; return 0; but a different way.

    using std::cin >> k;

    this shouldnt really change anything yet still when I try to gues I can guess once. Then again but then it closes straight away. ? Help ! xD

  • Great stuff... Why don't you use system ("pause"); instead?

    P.S. The best tutorial i've ever seen, learned quite a bit from it, look forward to the rest of the vids!

  • Comment removed

  • is there anyway to randomize the value of  theNumber?

  • @derick1259

    int theNumber = rand() % 100 + 1;

    This should make the integer, theNumber, a random number between 1 and 100.

    If you were to use something like:

    int theNumber = rand() % 100;

    then the integer, theNumber, would be a random number between 0 and 100.

    The addition operator after the actual number will result in it never being 0, and this can be very helpful in some programs. Hope I helped.

  • @IP95X newbie question :D

    int theNumber = rand() % 100 + 1;

    Won't make from 1 to 101? :O

  • if Besttutorial = true

    setmouseposition(Like Button)

  • Let me start by saying that your vids are amazing and in my own eyes flawless but in the program what command would we use to give the player more than one try?

  • @KingAuthora4eva

    i believe there is a way to loop it back to line 4.

  • little mistake 4:00 on for about 40 seconds is you forgot to change the h to the new variable "age". might be confusing for extreme n00bs who don't recognize that as a small mistake.

  • Omg, stop correcting him. He's doing just fine how he's doing it, and he's teaching other people how to do it as well! >:O 'Nuff said. BTW, love your tutorials you've taught me everything i know about C++. :D I thank you for using your spare time to help others. If only everyone was like you...Well anyways, thanks for helping the newbies out.

  • I dont understand what this means, to what is it referred?: if (true)

  • @xThorProductionsx

    if (true)  blablablabla (this)

    else blablablabla

  • @Elmoeoeoe

    i know that but what is true? or is it just a way to help learning?

  • @xThorProductionsx I think its just to help learning :D But I could be wrong.

  • @Elmoeoeoe

    Thats what but i can be wrong too ^^

  • Great tutorials. Quick clairifcation about the ( h > -1 )

    If h was a negative number less than -1 the if/else statement would yield a result contrary to our desires. True, h would need to be a float or double rather than an int, but it's a point of clarification you may want to consider for future tutorials.

  • really good!

    are you russian or something? 'becóuse' (because) hehe

    thanks!

  • Do you really need to put an is statement in the last else?

    Why not just write:

    else

    cout << "higher";

  • This is indeed n00b spoon fed. The greater and equal too, and the reverse, shouldn't have to be explained. Maybe if someone has never been taught any math at all. But I don't think you can go around programing without knowing basic math.

    __

    Great tutorials! Keep it up!

  • could be nice if "the number" could be changed every time you start a new game :)

  • You mispelled 2 things and it still worked, why is that? you said theNUmber, and player Gueass, how did it still work? and how do i make it where it wont cancel out of console untill i get the answer right?

  • @daeGamer aha, keen observations!

    I most probably cut out the part of the clip where i get compiler errors and i fix those mistakes :) now ain't I a sneaky one

  • @antiRTFM Oh, sneaky sneaky, i like your videos and im learning this, best videos out there. keep it up

  • @daeGamer ;) thanks

    See my channel FAQ #1 and #2

  • @antiRTFM @antiRTFM Sneaky maybe, but it doesn't illustrate that people should be checking themselves and it makes it look like there is some way to make it work when it shouldn't. Not a very good practice to teach people.

    Also, never assume the Player is always male.

  • @antiRTFM lol.

  • Why don't you use system("pause"); to keep console window open?

  • thanks for all your work :D, i cant wait to learn the input commands (i am a turing programmer, but that language is not at all powerful), and I want to see what I can apply from turing, here onto C++ :D

  • haha, I JUST SAW THE cin (i was typign this during the vid :O)!!

  • Can you tell me about using a sleep function so it waits like a couple seconds and then continue?

  • sleep (1000);

  • lol not not equal.

  • system ("pause"); to keep the window from closing ;)

  • "error: "system" was not declared in this scope"

    Isn't that only for C?

  • No.. Its because he spelled the command wrong.

    Theres no space system("pause")

    :)

  • I think it's only for windows, I'm using linux.

  • @kcj1993

    Well yea its only for windows.. you can use the cin.get(); it does the same

  • I've read system("pause") is bad programming/C++ practice

  • @tehepicasian

    you've read right, thats because system("pause") works only on windows and if you'll go on some programing tournament(yes that exists too) you're gonna be working on linux and linux only understands cin.get command

  • @WrestlingFanUploader

    Thank you for backing me up :DD

  • system("sudo apt-get install beep");

  • @tehepicasian calling the system commands is just not really needed, it is overkill when you could just use a C++ specific function.

  • nice! you make programming seem easy. the way you explain it, it is not complicated and it is understandable. Thank you so much for the tutorials. i plan to watch all of them eventually.

  • Still enjoying and LEARNING. Thank you AntiRTFM

  • first time ive ever tried to learn a computer language and every time i seem to do awsome on the little test things :D

    this is awsome :D [and quite fun xD]

  • i love you....i finally understand what my instructor has been saying all week....with you i understand right away......

  • man your a big help. thanks

  • this was fun. in the past 2 videos i really started seeing how all this code can be applied to making games/simulations.

  • Hey antiRTFM, can you tell me other game ideas that will put the things you taught so far to good use?

  • 6:53 - why you doing like that?

    char f;

    cin >> f;

    istead of that just write:

    cin.sync();

    cin.get();

  • (reads up on std::cin::sync...)

  • i have a problem.when i write exactly like you did my pc sad missinng ';'before constad.

    do you know what i did wrong???

  • Oh yeah, printf("The best tutorials, explained and in depth without having to get geeky!");

    Note printf("") if just an easier way of cout.

  • why not use cin.ignore(); instead of creating a useless variable?

  • Many ways, using the system("pause"); Would be easier too. Just ignoring when it says, "Press a key to exit".

  • Comment removed

  • BEST GUIDE EVER!!

    if (this guide < anyOtherguides) cout << "You will not find a better one silly!"

    GOGOGO

  • Comment removed

  • who do i get an input from the user?

  • Comment removed

  • type in the following:

    cin >> [variable];

    the variabe, of course, is up to your decision, the brackets are not required.

  • there are lots of ways to get input from the user, the most easy and broad way is using.

    cin >> variable;

    you can also use other such as (for char variables)

    cin.getline(variable, 256); (where 256 = variable size)

    or for strings you can use

    getline(cin, variable);

    getline(cin, variable) is good to use because you can take in all the input into a string, including white space.

  • how do i make that lets say if true than more things happen? i made that u have 3 tryes and i want lets say if u guess in 1st time than it already closes after pressing sumting. if i put char b; cin >> b; return 0; than it if doesnt match else. any idea?

  • yes you can have several return 0; statements inside your if() statements

    use {braces} for the body of your if statements, it'll help when you have more than 1 command to code /if/ indeed the if statement evaluated true

  • other then cin.get (); one can use the following whitch basicaly show a text saying press any key to continue. Just type this: system("Pause"); Hope it help! Peace, Ken ^-^ v

  • system("Pause"); is API - not very good programming habit so far as is depending on OS you use. cin.get (); is C++ method and suitable to any API

  • Comment removed

  • thx

  • another doubt, i sent a program to a friend, he has xp, and he coulndt run it (it was a program like the ones you teach us). Is there a "compatibility" option or anything like that? Thanks

  • see my channel FAQ #5

  • is there an explanation on why can't I keep using cin.get(); ????

  • couldn't you keep cin.get(); in, and put cin.ignore(); after the cin >> (w/e).

  • yup, could've :)

    though just trying to keep it simple for now

  • um i don't have a isostream file .. help

  • what compiler/IDE are you using?

  • miss spelt it LMAO noobish

  • Legend :D

  • Awesome teacher!  Thanks!!!!!!!!!!!!!!!!1

  • Hey how can i make it that it wont close sraight after i press the number.Like i learnt cpp before then forgot i remember using

    Sleep or somthing instead of char f; etc. Please pm me why lol :P im to lazy to come and check this page again ty man you own

  • thats "cin.get()" :o

  • thanx man! in the other tutorials a typed in the code, but i had no idea of wat i was doing, but with this videos you've uploaded now i am understanding c++ step by step 6/5 =)

  • this is explained in one of the first videos

  • You can also easily make an age-checking program with just this same outline.

    Thanks for your tutorials, antiRTFM. Keep 'em comin'.

  • Comment removed

  • Thank you antiRTFM. You make learning C++ much easier than my professor did

  • When I send my game to my friend, he gets an error - The application failed to start. The application runs perfect for me, but it doesn't work on any other machine. How can I fix this?

  • if you are using Microsoft Visual C++ you need to install the "Microsoft Visual C++ Redistributable Runtime" on any machine you want to run your program. You can get it easily from microsoft[dot]com or search google

  • Thanks for the fast reply, I'll try that :)

  • het antiRTFM i have a question.

    How do you keep the program running for you to keep guessing. Why do i only get one guess then it has to close?

    thanks. Please reply

  • you'll learn about 'loops' soon enough

  • HEY man, here is a usefull tip, insted of the cin.get thing, you could type

    system ("pause");

    ant the just press enter when you want to terminate the application, ty for ur vids thought they are great

  • I heard that is system based so it limits you applications to windows which is not good just to pause the program.

  • hi, dear all, please make friends with me as c++ partner

  • I noticed that in your previous videos you used endl; and now you are using \n. Even though I know what \n does...what is the difference? Should I use endl and \n in different situations?

  • 'endl' inserts a new-line character and also

    does something called "flushing the buffer"

    '\n' is just a newline escape character

    theres no difference really if its just about cout<<'ing a bunch of text like we're doing

  • you can use:

    system("pause");

    instead of cin.get() to pause the program.

  • If you know basic algebra or really basic mathematics the operators are pretty simple to understand.

  • even if you don't know basic algebra or really basic mathematics the operators are pretty simple to understand if you have a sense of logic and/or common sense.

  • Hey, before pressing debug you had an error again at the NUmber so i was excepting not to compile, but it worked and after it, it said Number :D magic

  • what error? what time in the video?

  • look at....let's say 8:33 if(playerGuess==theNUmber) cout << "you won!"

    and after that you compile it and when you go with the window down again, it says theNumber :))

  • You are right! i probably stopped the recording of the video to fix it up and then continued compiling

  • yeah

    that cin.get() ; thing was what I asked you the other day

  • these videos are bloody brilliant,

    totally awesome

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more