Added: 3 years ago
From: xoaxdotnet
Views: 116,439
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:
see all

All Comments (252)

Sign In or Sign Up now to post a comment!
  • everyone that knows of c++ has a major in NERD!

  • nice man

  • STD = standard

    okay

  • @Rick132500 I thought that...My mom thought it was sexually transmitted disease though...

  • whats the std:: for?? isnt that using namespace std;??? a shorter version of std::?

  • @RejPnoy No if you don't type using namespace std then you need to puy std:: with every cout.

  • @TheGameStrike Or in front of basically most functions

  • i got mad on myself cuz i forgot to subscribe you on tutorial 1

  • I like 21 too!<3 :)

  • how do u get the bar on the side that tells you how many lines of code you have wrote

  • mine closed after i told him my number so i added std::cin.get();

  • When i try use text it says shit like -141341231 when i try to type Hi ect. Some-one please help. Am i supposed to only use int for numbers?

  • @insurgency13 I am pretty sure int stands for integers, so yes, it only works for numbers

  • @insurgency13 actually, forget what I said before. I am pretty confused myself :P

  • from the last vid my didnt work. it nothing was red underlined and the problem was that i had to select the "end1" if i wrote it it wouldn't work help me PLZ

    to make things right

  • @TheOnlyGreed its an l not a 1

  • @TheOnlyGreed its not end1 its endL

  • erg it says that my second int is an error it says that it expected a ;

  • contrary to popular belief the c in cout actually stands for "character" not "console" because iostreams map values to and from character representations. cout can be redirected to write to things other than the console, like files.

  • WOW my faveroute number is actually 21!!

  • @dervish2173  stfu no one cares

  • If you type using namespace std; two spaces below the iostream you do not need to keep writing std: over and over again.

  • To run the code with debugging and have it wait for your input instead of closing as soon as you run it, just type in system("Pause"); before where ever return 0; is at.

    as IsaacWilsonaac stated earlier, the cin.get(); will work as well, but is messier, as you will have to put cin.ignore(); after everything that requires you to press enter. If you dont, then it will still close the program when you press enter.

  • @Broadwayftw thanks for that i was wondering why it ended right after i put in my number...:D

  • hey where is the Any key?

  • LOL dude : We didnt explain the code in that lesson hardly we will explain it here!

    LOL dude your so funny :D... great tutorial btw ! :)

  • also if u have problems with the window closing when u put in the number and hit enter then u can put cin.get() ; after cin >> iNumber and cin.get() ; before return o;

  • @xXxMinecraftBetaxXx

    I use Dev C++ too and your problem is that you cannot use int for letters for that type of program you would need string iName which also involves another #include statement listed underneath (no quotes)

    "#include -string-"

  • This guy needs to learn about

    using namespace std;

    It makes life so much easier and so does

    system("pause")

    U do need an extra include for system commands though underneath I will show it

    #include -cstdlib-

  • @ev5605 I'm only sure this guy that in later tutorials show you how to create console based RPG's and Win32 apps, knows all about using namespace std; There is a time and place to teach people, and there is more being using namespaces than people need to know about right now.

  • @ev5605 He uses it in later videos. It's not important right now, and there is more to using namespaces which he probably explains later as well. As far as I am aware, you don't need to include the cstdlib to use system pause or using namespaces though.

  • when i type a number I can quickly see it work, but the console auto closes on me right away, even with std::cin.get();

  • @RobeonMew @RobeonMew Right before you put "return 0;" at the end of the program, put SYSTEM("PAUSE");

    It should look like this...

    int main()

    { //CODE HERE system("PAUSE"); return 0;

    }

  • @ieRoMi

    actually worked. I figured it out before hand.

    but Visual studio is still not working for me. same error all the time. was told it cannot read the source libraries. but DEV-C++ is working. thanks for the tip

  • Waht about the PrintF command..?  What is the diference within PrintF and Cout?

  • @IsaacBG84 Printf is primarily used in C, not C++.

  • nice video

  • I wish you'd explain what we learned in the same lesson

  • why do you put the std in...it works without it...does it serve a purpose later on down the road?

  • For some reason when i write "what is you name? " and then bla bla bla, yes i rember that int iName and everything is fine i debug it and when i enter my name it's say "your name is -769466947659 and some random numbers... Please help1

  • @xXxMinecraftBetaxXx I THINK, not sure, but it's the variable. Int doesn't handle letters, char does, so maybe that's the problem? I'm not sure, I use Dev C++, not this program. I don't know how to fix it here, but you'll probably find out later in the tutorial.

  • @xXxMinecraftBetaxXx integers hold numbers, chars and strings hold values. If you wanted to write your name you would declare a variable like this...

    char myName[10];

    That would allow you to store 10 letters in the variable.

  • LINK : fatal error LNK1168: cannot open C:\Users\Wouter\Documents\Visu­al Studio 2010\Projects\Tutorial 1\Debug\Test.exe for writing

    Wtf does this mean? Please help. I can't find anything on Google.

  • after << iword << std::endl;

    whats wrong with this

  • including "#include "stdafx.h" " isn't necessary ?

    And program closes.. you have to add

    cin.get();

    return 0;

  • including "#include "stdafx.h" " isn't necessary ?

  • If you type below the first line, "using namespace std;" you won't have to put in "std::" so you can just type "cout<< "Hello World!" << endl;" Commands such as "cout" and "endl" are in the library "std."

  • @UnchainTheNight1

    And also, you don't have to put "endl" at the end of the line, inside the quotes of the message, just put \n (at the end).

    For example: cout<<"Hello World! \n"; would work fine. But make sure you get the right slash. It's \, not /

  • fixed it my self :D

  • @LCKLooney i fucked it up and fixed it my self :D high five :P

  • @LCKLooney how did u do it have exact same problem :(!!!!1

  • Hey i wanted to say that when my console window comes up and i click enter on a number it closes i have the same coding as u have help please ?

  • These are really good leason but what would be really help full with the video is with notes as review and stuff

  • You shouldn't have to add any pause statements if you run it without debugging. That was the case for me.

  • OH I FOUND IT!!

    FROM THE COMMENT POSTED BY LYRICSFORYOUNOW

    I TYPED SYSTEM(PAUSE) BEFORE RETURN 0

    AND IT WORKED!!

    I SUBBED TO U ANYWAY

  • PLEASE REPLY...

    WHEN I CLICK ON DEBUG AND TYPE THE INPUT(FAVORITE NUMBER AS 12) AND CLICK ENTER IT SAYS "YOUR FAVORITE NUMBER IS 12 " AND IMMEDIATELY CLOSES... IT DOES NOT WAIT FOR ME TO PRESS ANY KEY..

    OR IN SHORT IT DOES NOT TELL "PRESS ANY KEY TO CONTINUE"

    PLEASE HELP..

    ILL SUB TO U

  • @GeekingForJesus Try to press CTRL+F5 not just debug button.

  • thx very very much it is the best easy understandable tutorial video i have ever seen

  • oh... i know... thanks all :) awesome vids

  • how i can put the command "press any key to continue"?

  • I'm 11 looking to get into coding when I'm like 15-20, so I'm watching these to get a head start, This is literally the ONLY video/series that makes sense to me!!!

  • lol std

  • i wrote the exact same code and it doesnt work does anyone know why so ?

  • @WheNewWayOfSpeed u need to start without debugging (ctrl+F5)

  • To All who want the program to stay open after you enter the number. After the line return 0; and before the end bracket, but in this line: system("pause") ;

  • @chicken21200 well you can use cin.get() also....

  • I bet they made C++ in C++

  • @xMercuryx56 Lol! I bet for the later versions they did, but for the earlier versions they likely just used C or assembly.

  • @Protection4Real Probably. I know you can make games and all sort of software with C++

  • i was just wondering what kind of programs can you make in c++ can u make antivirus programs and so on in it?

  • Thank you so f*ing much man! you are the best!

  • Awesome. Awesome. Awesome. Thanks so much for making this video. So much easier to learn visually then reading from books.

  • @GeekingForJesus Takiado and Th3Colur look closer at 2:42 it tells you to start without debugging by pushing ctrl+f5

  • Comment removed

  • @GeekingForJesus - I had the same problem; then I realised I was still debugging it. You need to press Ctrl+F5, not just F5.

  • @GeekingForJesus

    for me I put:

    cin.get();

    at the end so that the window stays open

  • @GeekingForJesus u need to start without debugging (ctrl+F5)

  • @GeekingForJesus In some compilers you need to type system("PAUSE") after return 0;

  • @GeekingForJesus "I can't get the window to stay open after I type in my number and hit enter. I added the "std::cin.get();" line and it still closes after I enter my number and press enter."

    Type in "system("pause");" in the main function and before the closing brackets.

  • @GeekingForJesus add "system("PAUSE");"

  • @GeekingForJesus try  system("pause");

  • @Thet3 Thanks. Actually, I'm just going to remove my comment. I've literally gotten about 20 replies since I posted it. Maybe more.

  • Its much easier and faster to use the "using namespace std;" in the beginning m8 :)

  • I went a lot farther in the second part of this lesson but it still says "press any key to return" or something no matter how long my code list has gone i wont ever get past the "your favorite number is __" and I figured out how to add a ? by putting: << " " << "?" std::endl;

    but i cant get past the 'press any key' crap... i want a long conversation with my Command Prompt D:

  • IF you are using the c++ compiler dev-c++ , remember to type "system("pause") ;before return 0;

  • is there a lesson 2 for c++ 2010

    i tried to use std:cin.get(); but after i insert my favorite number, the window closes and i cannot see the part "your favorite..."

    what up ?

  • @OBeymydreamz Hmm. I'm not sure. But it's probably :: and not  :. I could be wrong too.

  • what is std::cin.get() and why is it not used here?

    sry ima total beginner at this >,<

  • @CrimsonTuber

    That tells the program to stay open instead of it shutting right away, but its not working like it did in Video 1.

  • if i choose to "debug" (F5) like in the last video, the window closes after if i hit enter after entering my favourite number but if i run without debugging (ctrl + F5) it works fine.

    just for the ppl who had abit of trouble with this

  • @anon1088 thx,

    i was wondering what was wrong with my version :D

  • @anon1088 why it happens like this? and the debug is done whit F5 whit u press ctrl? it works to me but im curious for feature pls answer

  • I replaced the word "number" with the word "color" in this tutorial at 2:25.

  • very relaxing and easy learning with this guy if you ask me. very happy with his tutorials.

  • I have type my code correct but i am still getting this error :

    Unable to start program 'C:\Documents ans Settings\Ni hoa\My Documents\Visual Studio 2008\Projects\Lesson2\Debug\Le­sson2.exe'.

    The system cannot find the path specified.

    Can any tell me what wrong

  • Comment removed

  • Comment removed

  • This is the code

    #include iostream

    int main()

    { std::cout "What is your favorite number? " std::end1; int iNumber; std::cin > iNumber; std::cout "Your favorite number is " iNumber std::end1; return 0;

    } 

  • what's with the  :: ???

  • @360kal Well basically, its like this:

    In C++, the "std::" is just how the language was built to be used. It basically means that you are using a standard function or command in C++. But programmers nowadays have clever shortcuts around this... for example:

    int main()

    { using namespace std; "program code, blah blah"

    }

    this line of code tells the interpreter to read all commands and functions preceded by "std::" to be included by default. (Less typing)

  • I entered everything as it shows in the video. When I run it, after I type in the number and press enter, the window disappears. Help, please?

  • @scottishjon1 what seems to be happening is, when your program ends, it doesn't wait for you to press any key like in the video, instead it just closes, so you don't have time to see the message "Your favorite number is x", a way around it would be to put another "std::cin>>iNumber;" before "return 0;" to act as a press any key message, but your program works fine anyways

  • @scottishjon1

    or try doing this type in

    system("pause");

    and it should not disappear the window

  • @justinkid10

    cin.get(); does essentially the same thing, but it is better because it is a command build into C++, not a specific operating system.

  • What's the difference between endl and \n?

  • @Ethaninja .. .. google it.. :) .. its the same thing anyways ..

    endl = End Line

    \n = new line

  • I enter a random number, press enter and the screen closes. Can anyone tell me how to fix this problem??

  • may i ask? for example after downloaded the software Visual C++ express and i want 2 run it without internet connection, can it still function or it requires internet connection? im asking this bcuz im jz using my cousins computer that has an internet connection, i hav my own computer but im not connected 2 the internet cuz i dont hav much money 2 pay monthly internet bill. so i hope someone in the xoax.net read this comment and reply as soon as possible...im need 2 learn programming tnx a lot.

  • That beginning room is kinda trippy

  • something wrong.as i wrote the code,the console windows closes down ,,i have to stop it adding "getchar()"... why? :-|

  • amasing tuts', just picking up the language, i know a few other languages, and these tuts make learning the c++ syntax a brease =)

  • man thanks u so much !

  • Bill Clinton!

    My program keeps closing after i enter a number and press enter. But ill figure it out.

  • @fleshtheworld put system("pause")

  • @fleshtheworld Put the line "cin.get();" as the last line and the program will stop and wait till you enter a key before closing.

  • I got this one memorized

  • To anyone who has the closing off error where it closes when you press enter the first time you are clicking start debugging i did the same stupid mistake >_>

  • if you type " using namespace std; " at the top before main, you don't have to type "std" everytime.

  • i dont under stand i press enter when i press a number and it's gone it did not show me "your favorite number is"

  • iNumber

  • You are such A SAVIOR MAN! thanks for everything. Thanks for sharing your knowledge.

  • Comment removed

  • from the demo at the end of tut.1, the black box looks like it would be kind of like Qbasic

  • mine doesnt say press any key to continue. it just closes mediately. help

  • @mtdeezy dont forget at the end," return 0; " it should work.

  • @mtdeezy don't for get to add std::cin.get(); at the end of the main function.

  • i dont have the option start without debugging

  • @mtdeezy press ctrl + F5 .

  • awsome dude!!

  • i write the number and Press enter but then the window shuts down:/ what now?

  • I wish I had these videos when I was learning for the first time! Really nice tutorials.

  • YOU ROCK BUDDY!!! Your tutorials are truly AMAZING!

  • when I openHello World thing it closes and says that it exits with code "return 0;"

  • @xBchify be sure its IN the curly brackets ( { } )

  • so start like this

    #include <ionstream>

    using namespace std;

    and then there is no need to put (std::) and at the end of the program you can put

    system ("pause");

    so that you get the

    "press any key to continue . . . " line to show up

  • Instead of using std : : before every command line would it be possible to instead just put " Using namespace std; " before the main function? Thanks.

  • Comment removed

  • C language ist the most economic language.

    With another languages I have to use a lot of commmands, but in C language only few lines is enough.

  • I'm a complete beginner to c++ so an explanation would be helpful.

    On executing this program the window closes (using microsoft visual c++ 2010).

    I attemted to use the std ::cin.get() ; line suggested in lesson 1, but it had no effect.

    Reading through other posts found

    system ("PAUSE");

    was sufficient to keep the window open, but I don't understand why std ::cin.get() ; fails.

  • @marksit it fails because when u enter the number , u press enter...so the enter remains and it is read by cin.get()...if you use two of them, one takes the "enter" from the number...and then the other waits for another enter...

  • if u just put using namespace std; below the iostream header, you dont need to put std:: next to everything

  • @unknown4lifes lol basic input and output is hard? haha

  • @unknown4lifes lol basic input and output is hard? haha

  • Para poder Pausar o Console é preciso Adicionar a linha final:

    system("pause");

  • 2:00 actually, it stands for sexually transmitted disease :P

  • this is nice....but its very similar to usi

    ng notepad with .bat commands.....

  • very gooooooooooooooooooooooood

  • thanks

  • couldnt you just before the main loop state (using namespace std;)

    instead of using std ::

  • Thanks alot!This is really helpful

  • Awesome info! Thanks for posting this and all related videos. You explain things so much better then that lady in the official C++ intro video.

  • @blproducer it's because "Man" was always smarter and "feminism" should be ended 4ever :D

  • @blproducer Females have always been bad at instructions :P

  • Thanks a lot for posting these tutorials.

    These are very nice tutorials and i can say best for the beginners.

  • it just sais to press eny key to continue =(

  • IT DOSE NOT WORK

  • YES IT "DOSE"

  • nice tutorials.

    you should sell this...

    your style is easy to understand...

    thanks

  • He doesn't have to he's already getting paid by Youtube from people watching his videos.

  • lol no he isnt xD

  • why std::cout.................whyn­ot cout<<

  • because, std:: you are using the standart namespace

  • will u please explain me whats this namespace thing..

    i wonder so many people here know bout that but i don't

  • u might saw sometimes that someone uses using namespace std;

    that means u don't have to type std:: after cout cin endl etc.

  • @TheEddiecallahan he never going to answer your question

  • well .. i can't figure out this whole namespace thing std and all..although i know a lot in c++..

    write back if u can help me..

  • I think, that should be a matter of efficiency

  • Comment removed

  • what is the red text supost to mean?

  • These are some nice videos! I need some help to get started, with the setup and the most basic syntax, just so I can play around with it before my classes start next semester. Very much appreciated!

  • Nice Video's man, your are really helping me out with C++ Keep up the Good Work :D

  • cout = character output

  • i thought it was console output lol

  • i read in the book "programmierhandbuch" (engl: programmer's handbook) by walter saumweber that it means character output. but maybe both is correct.

  • i read c++ for dummies and its console output

  • i love this man...