How do I handle key presses and key up events in the windows message loop? I need to be able to call two functions OnKeyUp (char c); and OnKeyDown (char c);???
@xXAceyboyXx Basically it means the main function has no output. If I remember correctly this is not allowed for the main function, but I'm not sure so don't take my word on that. (There's a reason why I'm watching this video obviously, I'm getting back to grips with C++...)
nice vids! I even got to my own solution for the program not closing before i could read the output! i just added "std::cin.get();" twice. one in between the first action and one at the end!
For those of you who get tired of typing "std::" before everything... just type:
using namespace std;
However, when using different functions from a different namespace (such as ios) you need to type the full function out since the code assumes you are always using the standard namespace. If we were using the I/O stream namespace, we would still have to type:
ios::beg
Anyways, that's just a little shortcut I thought I should share
i did the bool lesson using or || as logical operator, but its accepting only first two conditions and getting executed, if other conditions are added giving error report.....
Thank you so much for making these vids! This is really the only place on the net where C++ is explained well but quickly from a beginners standpoint.
@fayaz0707 I believe that main must ALWAYS return an int value to let the compiler know it built successfully. In other languages I am pretty sure main doesnt have to return int (like Java would be, public void main()) Just safely assume to always use int main().
When I used the cin.get and return 0; My program would still shut down after printing the g's. If this happens to you, you can use this instead of cin.get,
@LygisLT15 I agree with you, I am following these lessons using a Mac with Xcode and I tried the first example and i got an error that 'main' must return int. Void does not work. Then I tried 'int main' and it worked just as well. You know your stuff.
@mtdeezy Because the main function is declared as void main(). The other ones were int main(). void means no return value. int means return an integer(whole number). void functions can return at any point by putting in return;
He says zero and one correspond to true and false respectively. This is wrong. It should be the other way around, true is one and false is zero, as in the program on screen. Commentary wrong, program right.
VOID tells you, that a function doesn't have any returning values. In your case, your function is an INTeger function and have to return a number, like, in example a BOOLean function has to return TRUE or FALSE. I don't really remmember, but I think the compiler throuws you an error if you don't return something.
The prefix to the program is its return type, so if I do int main() and inside I have it say return 1; when I call the function it returns one. Void doesnt return anything.
Thank you very much
michmich1722011 1 month ago
Me gusta lo estoy siguiendo.. I like I'm following this video.
secretD00000 2 months ago
your videos need to be lonnngggeeerrr
A2ZDemise 2 months ago
This has been flagged as spam show
Answer the Question please:::
How do I handle key presses and key up events in the windows message loop? I need to be able to call two functions OnKeyUp (char c); and OnKeyDown (char c);???
sonfromheaven 2 months ago
where can i press this " \ "
I only got this " / "
plss help me>
treeky3 3 months ago
@treeky3
on a german keyboard its on the same position then ? or ß.
rexxar31337 2 months ago in playlist C++ Beginner Tutorials
no using namespace std? I see everyone else doing it.
BagsofRice 3 months ago
OMG THERE IS NO STRING?!
deluksic 4 months ago
@deluksic A string is just an Array of Characters.
SuperEpicSounds 3 months ago
@xXAceyboyXx Basically it means the main function has no output. If I remember correctly this is not allowed for the main function, but I'm not sure so don't take my word on that. (There's a reason why I'm watching this video obviously, I'm getting back to grips with C++...)
DaTux91 5 months ago
the other videos have a better audio-qualitiy
kellyfamily1994 5 months ago
scratch that had return 0 still up
kelly2000398 6 months ago
how do you keep you window up where it says press any button
like when i typed g and hit enter i quickly showed the other g
and closed down?
kelly2000398 6 months ago
im confused! if char can manipulate numbers, then why bother ever using int?
lolfreak21196 6 months ago
@lolfreak21196 because you might want to use only numbers in your program.
GherebenR 6 months ago in playlist C++ Beginner Tutorials
nice vids! I even got to my own solution for the program not closing before i could read the output! i just added "std::cin.get();" twice. one in between the first action and one at the end!
BboySnakeMaster 7 months ago
dude your very good teacher
goembario 7 months ago
dude, i think something happened to your Mic... :S
aljodewi 7 months ago in playlist C++ Beginner Tutorials
@TheAlascar
You would use string but that is not included in the iostream include you will have to add in
#include -string-
ev5605 8 months ago
void main() vs. int main() ???
petsoukos 9 months ago
@petsoukos I believe void means that you do not have to include the "return 0" statement.
ILikePie550 8 months ago
Thanks, I am now learning Visual C++.
IndAmit 9 months ago
It seems to me like double can do everything that int can do, so is there really a point in using int at all? Ever? Thanks, subbed.
PS: I would be happy if anyone answered :D
qwas12348gr5 9 months ago
@qwas12348gr5 Int is faster, you don't really notice it now, but later on you will.
(XD, that's what my programming teacher says. DOUBLE FTW!!!!!)
TheSpleenmaster 9 months ago
@TheSpleenmaster
LOL
Thanks
qwas12348gr5 9 months ago
One word of caution for those who are beginners; the following code would be wrong;
int ifull;
cin<<iFull;
the reason being is that when an int or other variable is declared it is case sensitive.
Magix1reaper 9 months ago
This has been flagged as spam show
@Magix1reaper its also wrong because cin goes this way >> :)
ProjectDuMa 9 months ago
@Magix1reaper its not just variables, everything is c++ is case sensitive
HoboAddiction 9 months ago
i continue to learn because of you.
IsaacWilsonIsaac 9 months ago
dude, you need waaaay more views than 45,000
you are like god of c++!
you totally helped me!
theyoyomasta 9 months ago
you should alter that zoom-in to show that semi colon at the end of the code it took me awhile to find out why the code didn't do anything
themetalguy200 9 months ago
For those of you who get tired of typing "std::" before everything... just type:
using namespace std;
However, when using different functions from a different namespace (such as ios) you need to type the full function out since the code assumes you are always using the standard namespace. If we were using the I/O stream namespace, we would still have to type:
ios::beg
Anyways, that's just a little shortcut I thought I should share
NeatStuff4iTouch 10 months ago
Thanks! This is really helpful!
toadking07 10 months ago
What data type would you use for words?
TheAlascar 11 months ago
He gives good lessons but he needs to be more enthusiastic.
at332 11 months ago
when I type g and hit enter the dialog dissapears
what do i have to add/change (i have the same code as you)
I am using Microsoft Visual C++ 2010 Express
MDSNproductions 1 year ago
@MDSNproductions Hello
edcard29 11 months ago
@MDSNproductions std::cin >> cCharacter; std::cout << cCharacter << std::endl; std::cin.get(); system("PAUSE");
}
edcard29 11 months ago
@MDSNproductions std::cin >> cCharacter; std::cout << cCharacter << std::endl; std::cin.get(); system("PAUSE");
}
edcard29 11 months ago
This has been flagged as spam show
@MDSNproductions std::cin >> cCharacter; std::cout << cCharacter << std::endl; std::cin.get(); system("PAUSE");
edcard29 11 months ago
I haven't been able to find the 'any' key...
PoizonFart 1 year ago
Im getting the hang of it:) a little.
PoizonFart 1 year ago
Hi
i did the bool lesson using or || as logical operator, but its accepting only first two conditions and getting executed, if other conditions are added giving error report.....
monalghosal 1 year ago
Thank you so much for making these vids! This is really the only place on the net where C++ is explained well but quickly from a beginners standpoint.
arooobine 1 year ago 8
i will like you use the libreri .stdio for mi wors i dont understen very well
inadatado 1 year ago
Why dont you use namespace std?
jayburnin 1 year ago
main must return int??
you must add this line of code before the end brackets }
return 0;
because your main function type is int
kmimsa 1 year ago
Teachers really should make these kind of videoes too, and the calm music in the background makes it easier to learn too
dragonyox 1 year ago
i have never seen anyone get more love on the internet...
kevkev797 1 year ago
When I follow the instruction I get this error?
`main' must return `int'
Why?
fayaz0707 1 year ago
@fayaz0707 I believe that main must ALWAYS return an int value to let the compiler know it built successfully. In other languages I am pretty sure main doesnt have to return int (like Java would be, public void main()) Just safely assume to always use int main().
ieRoMi 8 months ago
so when should int main() be used and void main() be used
CrimsonTuber 1 year ago
@CrimsonTuber Don't use void main()
ieRoMi 8 months ago
your smart
zwerty007 1 year ago
@gmodrox000 ha ha ha
Cruth8987 1 year ago
instead of adding: system("pause"); in the end,
you could add: system("pause > nul");
this will do the same, but it wont make any text.
01HiZZo 1 year ago
When I used the cin.get and return 0; My program would still shut down after printing the g's. If this happens to you, you can use this instead of cin.get,
system("PAUSE");
return 0;
I like it a lot better.
LiinerZz 1 year ago
Is the background song from The Legend of Zelda? LOL...
ShadowSky24 1 year ago
@materboy5 haha later on u will need to switch it back to void >8}
jussipejulliano 1 year ago
std::cin.get();
return 0;
Is not working because it thinks I press enter twice orso...
ordiantakeover 1 year ago
@ordiantakeover bullshit, your main function starts with ...VOID main...
for a void function you dont need to return something. try to replace void with int. that should work
LygisLT15 2 months ago 3
@LygisLT15 I agree with you, I am following these lessons using a Mac with Xcode and I tried the first example and i got an error that 'main' must return int. Void does not work. Then I tried 'int main' and it worked just as well. You know your stuff.
Stigm410 1 week ago in playlist C++ by XoaX.net
Didn't get what's ">>" and "<<" stands for..
MyRsIrl 1 year ago
why dont you need
return 0;
for this one?
mtdeezy 1 year ago
@mtdeezy Because the main function is declared as void main(). The other ones were int main(). void means no return value. int means return an integer(whole number). void functions can return at any point by putting in return;
howitzer24 1 year ago
He says zero and one correspond to true and false respectively. This is wrong. It should be the other way around, true is one and false is zero, as in the program on screen. Commentary wrong, program right.
Arqideus1988 1 year ago
When i Press Enter i just Shuts down plz help
Schoening91 1 year ago
@Schoening91
do you have MSV C++ 2010?
sfplayer911 1 year ago
@sfplayer911 Yes but now i Figured out. i use "INT" instead of
"VOID" and end with:
std::cin.get();
return 0;
Right?:P
Schoening91 1 year ago
@Schoening91 You can remove std:cin.get();
VOID tells you, that a function doesn't have any returning values. In your case, your function is an INTeger function and have to return a number, like, in example a BOOLean function has to return TRUE or FALSE. I don't really remmember, but I think the compiler throuws you an error if you don't return something.
LygisLT15 2 months ago
dissforlife, because he havent added any options in main funktion.
Im lithuanian, hoply you understood me ;D
I love your lessons!
C++ im back!!! <3
LygisLT15 2 years ago 22
@LygisLT15 I'am a Lithuanian too xD
Ricardas12 3 months ago
@LygisLT15 a
secretD00000 2 months ago
he is baked xD
asdernr 2 years ago
u guys are awesome, i wanted to learn C++ and i understand mostly everything that you are teaching.
so great job!
FallenDeathAssassin 2 years ago 3
wow this guy is realy kool
BBBSuper 2 years ago 39
Great tutorials, I got offset in my C++ studies and needed to catch up, this has been helping a ton :)
Why exactly is the function "void" instead of "int" this time around?
dissforlife 2 years ago
I was wondering the same thing, but I'm sure it will be explained later bro.
HighlyBored 2 years ago
@HighlyBored
I got it like a week ago xD
The prefix to the program is its return type, so if I do int main() and inside I have it say return 1; when I call the function it returns one. Void doesnt return anything.
I think :D
dissforlife 2 years ago
Correct. Void means it doesn't return anything.
SlimJimVG 2 years ago
because it doesn't return anything. notice it doesn't have "return 0;"
MrNichre 2 years ago
@dissforlife the datatype before a function the value the function will return. void will return no value, and int will return an integer value
AES256bit 2 years ago
A void return type on main is non-standard and should be avoided.
Standard conforming signatures for main are:
int main()
int main(int argc, char** argv)
int main(int argc, char* argv[])
BoxyDevel 2 years ago