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).
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?
@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
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?
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.
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.
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.
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?
@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.
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
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
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.
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?
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
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
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 =)
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
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?
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
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).
RemovdSande11 2 weeks ago
This has been flagged as spam show
catsnorkel 1 month ago
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????
DrMu5tCh3at2W1n 3 months ago
Ty so much for these videos, This way of learning is more fast and efficient.
KingsBrothers 4 months ago
'-'
marcelinhovr 6 months ago
Comment removed
shadowalker101 6 months ago in playlist C++ Tutorial - Absolute n00b Spoonfeed
it says that 'playersGuess' is an 'undeclared identifier'?
help
DarkVortex97 6 months ago
Guess: I hope the next video lesson is about simple looping. :D
iExD 7 months ago
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?
Neosiotype 9 months ago
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 10 months ago
@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
surferdude7474 3 months ago
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 11 months ago
@MyJizzHasFizz you have to say if (a==b) because otherwise you are setting a equal to b when you say a=b
Evanisawesome54321 8 months ago
i don't get the need for the bool
kingdomkey1412 1 year ago
7:57
magic happens :D
minnieskater 1 year ago
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
appledrum2a 1 year ago
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!
Idolismo 1 year ago
Comment removed
ExtremeRunning1 1 year ago
is there anyway to randomize the value of theNumber?
derick1259 1 year ago
@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 1 year ago
@IP95X newbie question :D
int theNumber = rand() % 100 + 1;
Won't make from 1 to 101? :O
xXxDiukexXx 1 year ago
if Besttutorial = true
setmouseposition(Like Button)
TheTntuser 1 year ago
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 1 year ago
@KingAuthora4eva
i believe there is a way to loop it back to line 4.
N0wShutUp 1 year ago
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.
brainless14 1 year ago
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.
Helljkillers 1 year ago
I dont understand what this means, to what is it referred?: if (true)
xThorProductionsx 1 year ago
@xThorProductionsx
if (true) blablablabla (this)
else blablablabla
Elmoeoeoe 1 year ago
@Elmoeoeoe
i know that but what is true? or is it just a way to help learning?
xThorProductionsx 1 year ago
@xThorProductionsx I think its just to help learning :D But I could be wrong.
Elmoeoeoe 1 year ago
@Elmoeoeoe
Thats what but i can be wrong too ^^
xThorProductionsx 1 year ago
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.
JZino 1 year ago
really good!
are you russian or something? 'becóuse' (because) hehe
thanks!
joaolggross 1 year ago
Do you really need to put an is statement in the last else?
Why not just write:
else
cout << "higher";
Forcalious 1 year ago
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!
BrokenBjartur 1 year ago
could be nice if "the number" could be changed every time you start a new game :)
Jackie00100 1 year ago
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 1 year ago 6
@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 1 year ago 19
@antiRTFM Oh, sneaky sneaky, i like your videos and im learning this, best videos out there. keep it up
daeGamer 1 year ago 14
@daeGamer ;) thanks
See my channel FAQ #1 and #2
antiRTFM 1 year ago
@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.
Maverynthia 1 year ago
@antiRTFM lol.
iExD 7 months ago
Why don't you use system("pause"); to keep console window open?
Darumender 1 year ago
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
TechTubeMedia 2 years ago
haha, I JUST SAW THE cin (i was typign this during the vid :O)!!
TechTubeMedia 2 years ago
Can you tell me about using a sleep function so it waits like a couple seconds and then continue?
TheCrysisfan 2 years ago
sleep (1000);
Priziner 2 years ago
lol not not equal.
kcj1993 2 years ago
system ("pause"); to keep the window from closing ;)
cvucs86 2 years ago
"error: "system" was not declared in this scope"
Isn't that only for C?
kcj1993 2 years ago
No.. Its because he spelled the command wrong.
Theres no space system("pause")
:)
Fjerdue 2 years ago
I think it's only for windows, I'm using linux.
kcj1993 2 years ago
@kcj1993
Well yea its only for windows.. you can use the cin.get(); it does the same
Fjerdue 2 years ago
I've read system("pause") is bad programming/C++ practice
tehepicasian 2 years ago
@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 2 years ago
@WrestlingFanUploader
Thank you for backing me up :DD
tehepicasian 2 years ago
system("sudo apt-get install beep");
brokenbylaw2 1 year ago
@tehepicasian calling the system commands is just not really needed, it is overkill when you could just use a C++ specific function.
0121ryanh117 2 years ago 2
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.
UNR3S7 2 years ago
Still enjoying and LEARNING. Thank you AntiRTFM
thenextorion 2 years ago
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]
TheGenetic1 2 years ago 2
i love you....i finally understand what my instructor has been saying all week....with you i understand right away......
ramzyray 2 years ago 2
man your a big help. thanks
giggitygoo619 2 years ago 4
this was fun. in the past 2 videos i really started seeing how all this code can be applied to making games/simulations.
ccaaeeiioouuss 2 years ago 2
Hey antiRTFM, can you tell me other game ideas that will put the things you taught so far to good use?
Tarzanlovesujane 2 years ago
6:53 - why you doing like that?
char f;
cin >> f;
istead of that just write:
cin.sync();
cin.get();
montimer357 2 years ago
(reads up on std::cin::sync...)
antiRTFM 2 years ago
i have a problem.when i write exactly like you did my pc sad missinng ';'before constad.
do you know what i did wrong???
agerian13 2 years ago
Oh yeah, printf("The best tutorials, explained and in depth without having to get geeky!");
Note printf("") if just an easier way of cout.
ryancfcsas 2 years ago
why not use cin.ignore(); instead of creating a useless variable?
ttwooone 2 years ago 2
Many ways, using the system("pause"); Would be easier too. Just ignoring when it says, "Press a key to exit".
papano12 2 years ago
Comment removed
DragoonMasterKaine 2 years ago
BEST GUIDE EVER!!
if (this guide < anyOtherguides) cout << "You will not find a better one silly!"
GOGOGO
AmirReborn 2 years ago 6
Comment removed
brokenbylaw2 2 years ago
who do i get an input from the user?
gamma526 2 years ago
Comment removed
wmhunter 2 years ago
type in the following:
cin >> [variable];
the variabe, of course, is up to your decision, the brackets are not required.
SomeoneHackedMyName 2 years ago
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.
0121ryanh117 2 years ago
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?
jurtin3 2 years ago
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
antiRTFM 2 years ago
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
Elistios 2 years ago
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
ottademogog 2 years ago
Comment removed
DevTeamTutorials 2 years ago
thx
efrog57 2 years ago
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
efrog57 2 years ago
see my channel FAQ #5
antiRTFM 2 years ago
is there an explanation on why can't I keep using cin.get(); ????
efrog57 2 years ago
couldn't you keep cin.get(); in, and put cin.ignore(); after the cin >> (w/e).
Begnion 2 years ago
yup, could've :)
though just trying to keep it simple for now
antiRTFM 2 years ago
um i don't have a isostream file .. help
KnuckleAndSlider 2 years ago
what compiler/IDE are you using?
antiRTFM 2 years ago
miss spelt it LMAO noobish
KnuckleAndSlider 2 years ago
Legend :D
babyaiko 2 years ago
Awesome teacher! Thanks!!!!!!!!!!!!!!!!1
bgbyer 3 years ago
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
bloodzcape 3 years ago
thats "cin.get()" :o
98Zai 3 years ago
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 =)
superjuice19 3 years ago
this is explained in one of the first videos
antiRTFM 3 years ago
You can also easily make an age-checking program with just this same outline.
Thanks for your tutorials, antiRTFM. Keep 'em comin'.
RedParkSR111 3 years ago
Comment removed
3ccentrik 3 years ago
Thank you antiRTFM. You make learning C++ much easier than my professor did
nitro420 3 years ago
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?
Alliance72 3 years ago
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
antiRTFM 3 years ago
Thanks for the fast reply, I'll try that :)
Alliance72 3 years ago
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
mdudemaster 3 years ago
you'll learn about 'loops' soon enough
antiRTFM 3 years ago
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
juandude32 3 years ago
I heard that is system based so it limits you applications to windows which is not good just to pause the program.
Sadlez 3 years ago
hi, dear all, please make friends with me as c++ partner
artisticnight 3 years ago
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?
adamwitte 3 years ago
'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
antiRTFM 3 years ago
you can use:
system("pause");
instead of cin.get() to pause the program.
jdk865 3 years ago
If you know basic algebra or really basic mathematics the operators are pretty simple to understand.
CJNBrothers 3 years ago
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.
DarkSticks 3 years ago
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
MihaiZeu 3 years ago
what error? what time in the video?
antiRTFM 3 years ago
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 :))
MihaiZeu 3 years ago
You are right! i probably stopped the recording of the video to fix it up and then continued compiling
antiRTFM 3 years ago
yeah
that cin.get() ; thing was what I asked you the other day
danielghofrani 3 years ago
these videos are bloody brilliant,
totally awesome
kamyarghofrani 3 years ago