Buckys C++ Programming Tutorials - 19 - Simple Program Using a Loop

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 294

  • @JacquesMWest
    @JacquesMWest 9 лет назад +309

    I'm sorry, but this is literally the clearest 360p video I have ever seen in my life.

    • @laurelclementedinopol3615
      @laurelclementedinopol3615 8 лет назад +1

      +Jacques West (West Coast Aviation) yeah... check out his other video showing his house... and you'll know why... :D

    • @wafflez9888
      @wafflez9888 8 лет назад +1

      +Laurel Clemente Dinopol Link please :D

    • @zapxcero
      @zapxcero 7 лет назад +3

      LMFAO YOU SAID IT

    • @yosansu
      @yosansu 4 года назад +1

      ikr

  • @beastgod5554
    @beastgod5554 10 лет назад +295

    your tutorials>college

    • @JonathanPunti
      @JonathanPunti 7 лет назад

      Yes!!!

    • @ian31415
      @ian31415 6 лет назад +1

      not really, you are just learning syntax here.

    • @shutdahellup69420
      @shutdahellup69420 6 лет назад +3

      @@ian31415 thats all you really need and some examples... then rest depends upon your creativity and practice.

    • @ian31415
      @ian31415 6 лет назад +3

      @@shutdahellup69420 cool, so can you help me parse a string of the form [-]n1 / [-]d1 op [-]n2 / [-]d2 where n and m are denominators and the negative signs may or may not be there and op is + - / or * from these tutorials? What about doing it with tree's? Can you explain a tree from watching these videos? They're pretty useful.. pretty sure a B+ tree is used to store files on Microsoft so it's not just theory. But not the kind of thing you can realistically come up with creativity unless you have a math PhD.

    • @hutlazzz
      @hutlazzz 5 лет назад +5

      @@ian31415 Internet tutorial will make current academia education useless. Eventually will turn out just like this in future,ton of lecture and exemple from home... Thats the future of learning.

  • @davidmuhs4590
    @davidmuhs4590 8 лет назад +33

    OH MY GOSH I LOVE THIS. PROGRAMING IS GONNA BE SO FUN SO GLAD I HAVE THIS VIDEO SERIES.

  • @GJH465
    @GJH465 9 лет назад +34

    Been watching you on solo learn to learn c++ and you are great. Sir a applaud you

  • @JowyFull47
    @JowyFull47 8 лет назад +36

    Thanks man, I just started programming about 1 year ago, I'm 25 now and thanks to you I have been able to keep up in class. currently studying to be a software engineer. thanks bro, wish all the professors were like you.

    • @RangerMcFriendly
      @RangerMcFriendly Год назад +2

      1st year here, how did it all go? Did you end up as a software engineer?

    • @chicharhon1351
      @chicharhon1351 Год назад

      ​@@RangerMcFriendlyman me too i wanna know

  • @vicda5941
    @vicda5941 8 лет назад +5

    bucky, your videos are awesome. I really enjoy them. I've been struggling in my c++ class, but after watching them, everything in class starts to make sense.

  • @Galluxi
    @Galluxi 9 лет назад +48

    Btw guys, you can just type total += number;

    • @river6634
      @river6634 8 лет назад +1

      +Geometry Dash Galluxi Nice to know it works for C++

    • @Galluxi
      @Galluxi 8 лет назад

      +Riverreed Ward :)

    • @dereklampa4544
      @dereklampa4544 8 лет назад +1

      +Geometry Dash Galluxi That'll work. Although thenewboston only kept it simple, not efficient and quicker.

    • @Galluxi
      @Galluxi 8 лет назад

      +Derek Lampa (Trackten369) "+=" is simplier

    • @dereklampa4544
      @dereklampa4544 8 лет назад

      Geometry Dash Galluxi I know. Most newbies do not know "+=" so they use it basic ways like "x = x + y" since that looks very basic while we use "+=" for more efficient in writing codes.

  • @alisonmcewin6352
    @alisonmcewin6352 10 лет назад +2

    You are the sole reason I'm understanding programming. Paid wayyyy to much for this class

  • @cristiannaziru1987
    @cristiannaziru1987 8 лет назад +3

    Alright this is a bit confusing now. We didn't even need the "(x

  • @DimitrisBoump
    @DimitrisBoump 12 лет назад +17

    I think you forgot to day "Pretty cool aha?" :P

  • @Vorbis5
    @Vorbis5 13 лет назад

    Bucky, you gatta be the coolest guy on the internet. All your little quirky things just make you so awesome.

  • @shadane1436
    @shadane1436 8 лет назад +87

    better than my professor

    • @Benjy1
      @Benjy1 8 лет назад +14

      I wish he was my professor

    • @usmankhalifa5699
      @usmankhalifa5699 8 лет назад +6

      same

    • @beri4138
      @beri4138 7 лет назад +1

      +Benjy L
      Oh my god that would be so awesome!

  • @Double_Wood
    @Double_Wood 12 лет назад

    "total += number;" ... is another nice way of writing... "total = total + number;" ... a lot of languages don't offer these nice shortcuts so i like to use it where ever possible!

  • @SeifOrabi
    @SeifOrabi 11 лет назад +7

    Couple of million dollars, and you call this a calculator? LOL!
    Love your tutorials Buckey.

  • @exsertchillax
    @exsertchillax 13 лет назад +1

    Finally, I learned something useful and something that is not advanced to remember, such as classes. ;)

  • @nightprogrammer7474
    @nightprogrammer7474 8 лет назад +43

    just a couple million of dollar :)

  • @AsadAli-om9ir
    @AsadAli-om9ir 2 года назад +3

    The name C++ actually came from the concept of Unary Arithmetic Operator ++. So, C++ actually means C+1. 1:30

  • @hello838
    @hello838 12 лет назад +1

    This is a good reminder and a wake up call for me :)

  • @danieldimitrov6562
    @danieldimitrov6562 11 лет назад +1

    I FINALLY UNDERSTANT IT.
    THANK TOU SO MUCH BUCKY !!!!!!!!!!!!!!

  • @marcus9393
    @marcus9393 3 года назад +1

    Bucky after 19 tutorials : Okay! Lets do something useful now

  • @TheVincenthwind
    @TheVincenthwind 12 лет назад

    After hearing the problem, I paused the video and tried to figure it out myself. To my grand surprise, I succeeded. I decided to watch the video anyway and found that what took me 40 lines of code to do (granted, I had extra some extra cout lines), took Bucky only 15. So I can code, I just manage to do it in the most inefficient way possible.

  • @ahmedhamdy812
    @ahmedhamdy812 12 лет назад

    The two teachers that were disliking each video, got tired because of the large number of videos.
    Bucky wins.

  • @safrinabohel7324
    @safrinabohel7324 6 лет назад

    your video really help me a lot i watched it from the first tutorial and i'm gonna finish it..than sitting in the class almost 3 or 4 week and i don't get anything from it....anyway thank u..your video is the best and it's really easy to understand..

  • @johnmurphy1248
    @johnmurphy1248 6 лет назад

    "So our program is working five and dandy so far." - This is why I enjoy watching Bucky.

  • @HexPlays
    @HexPlays 13 лет назад

    for those of you looking to get the average number of the 5 put this below you cout

  • @2marshtomp
    @2marshtomp 12 лет назад +3

    I can explain Bucky's life in 3 words :
    Awesome
    Bacon
    and
    "So you're sayin alright...."

  • @hungrygrimalkin5610
    @hungrygrimalkin5610 10 лет назад +1

    Always declare variables with default values for better memory managing.

  • @Dansscreen
    @Dansscreen 12 лет назад

    6:35
    lol that cracked me up.. such a casual 19 episode build up to this moment

  • @Arthurk346
    @Arthurk346 5 лет назад

    "...wecome to your 19th tutorial. And you know what? The bacon from previous tutorial was tasty."

  • @devChoco
    @devChoco 2 года назад

    Thank you Bucky for the advice especially.

  • @lickguitars1276
    @lickguitars1276 Год назад

    great tutorial, it help me alot in understanding how to think logically

  • @rbrik4747
    @rbrik4747 9 лет назад

    Just to point out, Bucky, using ++ as an easy and quick increment also seems to be less CPU intensive therefore this is now considered a good practise :)

  • @dibbiepk
    @dibbiepk 12 лет назад

    LOL!!!! Love the ending "Ill see you next time when im a millionare!" :P
    By the way, to clear up some questions you may have he missed:
    What if they enter 6 numbers? Then you need an else statement, somthing like else() { cout "You can only enter 5 numbers man... dont chate me!" } or whatever

  • @casperes0912
    @casperes0912 11 лет назад

    English is not just words put together, it basically also has something called grammar. Try it out, it makes reading messages a lot easier

  • @TheCosmicChicken
    @TheCosmicChicken 12 лет назад +1

    I put on captions; here's a sampling of the gems I got:
    "Let's go ahead and just give him a nice little pronounced rain [...] mom"
    "The first time the user anti remember it was ten so the total which was a hero before is now equal to zero plus ten so now totally host ten the next summer they entered was aids"
    "Now it it was twenty five blasphemous five also"
    "You guys in goa injected on calculator into words enemies who just build the best calculator unearth"

  • @timlyo
    @timlyo 12 лет назад

    Good to know
    Your comment made me feel warm and fuzzy inside too :D

  • @dibbiepk
    @dibbiepk 12 лет назад

    @TheBeuteOffical Yes, its possible, if you use a String instead of a Int, Strings hold 1 letter, ints hold numbers, you might learn about that later on

  • @gnaneshg7663
    @gnaneshg7663 6 лет назад

    Best c++ tutorials

  • @tlita93
    @tlita93 10 лет назад +2

    Shorter version of total = total + number is total += number :)

  • @mokomamaminecraft
    @mokomamaminecraft 10 лет назад +28

    you could just do "total += number"

    • @LukasTeeVee
      @LukasTeeVee 10 лет назад +16

      And I thought people telling him to use "bacon++" in the last tutorial were sad...

    • @SirRobbStarkGamin
      @SirRobbStarkGamin 10 лет назад +8

      ***** you have to keep in mind, these tut's are for complete noobs to c++, so they way he does it explains it better, bacon ++ is just a shortcut.

    • @Rahulbajaj561
      @Rahulbajaj561 5 лет назад +6

      I'm very sure that he knows different ways of writing the same code, but remember he's making these tutorials for complete beginners who have zero knowledge about programming. so he knows what is the best. you don't have to tell him what he needs to do just to look smart . and if this wasn't your intention re-frame your sentence.

    • @Rahulbajaj561
      @Rahulbajaj561 5 лет назад +2

      jeez, why am i even replying to a 4 year old comment?

    • @catlover4ever104
      @catlover4ever104 5 лет назад +5

      @@Rahulbajaj561
      hey dude I like ur username

  • @marko4449
    @marko4449 13 лет назад

    holy shit!!! i just made a stone aged calculator :D im starting to like this tutorial a lot :D

  • @ianiket0013
    @ianiket0013 9 лет назад

    Thank you bucky for sharing the video..........................

  • @aether-s2842
    @aether-s2842 6 лет назад +2

    So whats the point of "x" being there after you have made the int "number"?

  • @TsvetomirLazarov
    @TsvetomirLazarov 11 лет назад

    No, because it will increment it only by 1. But you can make it like this:
    total+=number;
    That will add number to the total.

  • @zeustheboerboel3794
    @zeustheboerboel3794 8 лет назад +2

    You already are a millionaire for me!!!! ;)

  • @Phl3xable
    @Phl3xable 13 лет назад

    cheers, can't wait for more!

  • @pabloolbap6478
    @pabloolbap6478 2 года назад +1

    cout

  • @patricengao9415
    @patricengao9415 2 месяца назад

    Anyone noticed that the number of integers you enter has to coincide with the test, otherwise if you enter fewer integers, the program iterates addition of the last integer up until the test is met? Good one though, Bucky!

  • @BradenBest
    @BradenBest 8 лет назад

    Okay...I don't know why my comment disappeared with an "unknown error". So I guess I'll just post it again
    - - - -
    1:22 `x++` and `x = x + 1` are not the same. x++ is actually a very unusual operator that, unlike every other type of assignment there is in C, returns the value of x BEFORE performing the operation
    If x is 1...
    int y = x++; // y = 1
    int y = ++x; // y = 2
    int y = x = x + 1; // y = 2
    int y = x += 1; // y = 2
    The way you can tell the difference between x++ and ++x, if "x++ is a post-increment and that is unusual" isn't good enough, is in the order of the tokens:
    x++ return and then increment
    ++x increment and then return
    The "expression returns its result" trick works very well with another fairly obscure language feature most often seen in obfuscated/golf'd code: the comma operator
    If you can figure out the results of this expression, then you have a decent understanding of the comma operator:
    result = ((a < b ? (puts("complexity!"), c = a + b, d = c * b, d + c + b + a) : (puts("simplicity!"), result +=b)), 20 + 10 + 12);
    ...for (a,b) in (4,5), (7,6), (0,0), and (12,9)
    If you can understand the source code for Muller's original brainfuck interpreter*, then you don't even need to be reading this.
    * For some reason, it's really hard to find online. It looks like the original distribution is no longer around. I happen to have the source code lying around, though, so here it is: pastebin.com/X04CiBX9
    Lots of clever tricks in there. From the header of the for loop and how it combines assignment with the base case, to using pointer arithmetic to share memory (bf source code and "user memory") and step through the source code, to using && and || and ?: in place of if/else, to abusing the comma operator to avoid writing {} brackets for the for loop. It's got it all, and is an excellent showcase for how expressive C is.

  • @P4INKiller
    @P4INKiller 12 лет назад

    Because it was TOO AWESOME.

  • @belgacuervo
    @belgacuervo 12 лет назад

    to keep it simple, this is basic programming. But total +=number is legit.

  • @MultiThunder54
    @MultiThunder54 12 лет назад +1

    total+=number;
    works the same way and saves you keystrokes.

  • @chxse1817
    @chxse1817 7 лет назад

    Python: 8 lines of code
    C++: 20 lines of code

    • @chxse1817
      @chxse1817 7 лет назад +1

      x lines of code assuming that each statement is on a new line, just as well-written code should be. When you have everything on one line you cannot possibly debug. The compiler only tells you which line the code error is on, and a brief description of what was wrong. You can see the issue here.

  • @evanmastermind
    @evanmastermind 11 лет назад

    x++ adds 1 to the variable "x"... x

  • @olivebates
    @olivebates 13 лет назад

    you can also do x+=1, same outcome

  • @abirishtiaque9749
    @abirishtiaque9749 10 лет назад

    Hey Bucky where are your tutorials about converting strings to lower case or upper case letters and finding out their lengths and all those stuff ?

  • @casperes0912
    @casperes0912 11 лет назад

    That would make sense. Thank you.

  • @ouisabughazaleh1187
    @ouisabughazaleh1187 5 лет назад

    "let's just copy this and email this to microsoft and hopefully they pay me you know just couple of million dollars for it " i actually laughed so hard and paused the video for a bit

  • @IReDoXI
    @IReDoXI 11 лет назад

    *INCLUDE AND NAMESPACE*
    int main()
    {
    int x;
    cout

  • @KingKilleer96
    @KingKilleer96 8 лет назад +1

    best calculator on earth xdxdxdxd

  • @Busola29
    @Busola29 7 лет назад

    I think this program better works with long command...
    Where is now bucky , family , maybe no time or work for corporation?
    GZ for best C++ tutorials Bucky , Bucky go to
    Next year i will bee millionere... :)

  • @venkateshkulkarni2227
    @venkateshkulkarni2227 5 лет назад +1

    Shouldn't an error be shown if I enter more than 6 numbers as the input?

  • @rbsupercool
    @rbsupercool 11 лет назад

    preeeeeeeeeeeeettty cooooooool hahhhhhhhhh!!!!!

  • @creehoggan4327
    @creehoggan4327 10 лет назад +2

    when you enter a number over 9 digits, the computer explodes.

  • @pancekaradzov3885
    @pancekaradzov3885 10 лет назад +29

    Did you become millionaire? :D

    • @ТайныйЯ-к3ь
      @ТайныйЯ-к3ь 10 лет назад +3

      Of course, he did.

    • @Veldr0N
      @Veldr0N 10 лет назад +8

      I think he knows all the programming languages in the world so,he did indeed

    • @pancekaradzov3885
      @pancekaradzov3885 10 лет назад +2

      I guess that. I am dreaming to become one day like him doh :)))

    • @IgorAherne
      @IgorAherne 9 лет назад

      VeldroN hello :D

    • @kursatsaimtuna7163
      @kursatsaimtuna7163 6 лет назад +2

      have you achieved that goal? :)

  • @TheElectronics0
    @TheElectronics0 12 лет назад

    You must use #include -LSS-string-GTR- and replace any int with string

  • @kyy6150
    @kyy6150 8 лет назад +2

    Why when i position "int total=0;" inside the While loop function , i get an error?

    • @MAlicechan
      @MAlicechan 8 лет назад

      If you declare a variable inside the loop, it will only be defined as a local variable within that loop, meaning that it will not work in the main function. Also it will initialize it every time the loop repeats (which means it will return back to being = 0). tl;dr it's bad practice to initialize variables within loops (exception is for loop counter)

  • @chulibran
    @chulibran 12 лет назад

    You are the best. Really.

  • @mrbeantje1
    @mrbeantje1 13 лет назад

    @SuperHappyvideo
    x++
    adds 1 to x
    if x = 1
    and u do
    x++
    cout

  • @SmithsRichard
    @SmithsRichard 12 лет назад

    You can also do total += number;

  • @crjacinro
    @crjacinro 13 лет назад

    Hey MR. Bucky Roberts,, how many c++ tutorials have you made so far???
    So far, i have seen 3 series tutorials on C++ :
    - Bucky's C++ Programming Tutorial (Code:Blocks, 2011)
    - C++ Tutorial (dev C++, 2008)
    - C++ Programming Tutorial (Code Blocks , 2010)
    so which of these tutorials am i gonna watch first as a beginner??
    whats d diff between the 2010 and 2011 tutorial??
    thanks..i just want to learn c++ ..
    NICe VIDs by the way...

  • @TheBscit
    @TheBscit 13 лет назад

    @bKfASSASSIN
    I dont think he said it wasnt in C. I think the C++ thing pretty much means that C++ is a simpler and faster way
    than C just like how n++ is a a simpler way of n = n+1

  • @A1701D
    @A1701D 10 лет назад

    Good example, however teaching var++ before ++var may not be the best in terms of coding etiquette -- while they yield (more or less) the same result, generally unless you have a reason to use the post-fix operator you should use the prefix operator (code-wise, it is technically faster and more efficient). Something I learned from my coding class.

  • @iaybalac7874
    @iaybalac7874 7 лет назад

    I understood everything in the tutorial but still, I have a question:
    So i, didn't set a number for total at first, just out of curiosity, i left it as just a variable like int total;
    and then everything went perfectly fine but it just calculated the whole thing wrong. Why exactly is that?

  • @josejaimefelixgarciagarcia8884
    @josejaimefelixgarciagarcia8884 10 лет назад +2

    Hahahaha nice folder name bucky. 5:22

    • @DromeG60
      @DromeG60 10 лет назад +2

      Have you skipped half the tutorials?

  • @2marshtomp
    @2marshtomp 12 лет назад

    I was actually thinking about that exact thing 2 days ago...

  • @LosEagle
    @LosEagle 11 лет назад

    Thanks! Never noticed :)

  • @ARYAINDIA1997
    @ARYAINDIA1997 11 лет назад

    I'll rather preffer to study from here rather than BOOKS!

  • @seaverschultz932
    @seaverschultz932 9 лет назад

    i need help. A message keeps appearing saying that "cannot open output file bin
    elease\trivia game. exe access denied" the program is called trivia game. What does this mean?

  • @KyLey1990
    @KyLey1990 13 лет назад

    @TheNeweN24 not sure if this is in engineering but its in computer science for sure

  • @ssss540
    @ssss540 8 лет назад

    Thank you sooooo much!!!

  • @armasxu
    @armasxu 8 лет назад +3

    i like your good commendatory!!!
    copy and paste it to microsoft and be a millionaire hahaha

  • @hoseashiliyo7542
    @hoseashiliyo7542 6 лет назад

    very nice tutorial

  • @ste5402
    @ste5402 7 лет назад

    Someone explain this tutorial to me, please? I understood the thing about the total, but I don't quite get the stuff he wrote about the x variable. Especially, I didn't get why int x must be set to 1.

  • @klodiqoshku4315
    @klodiqoshku4315 5 лет назад

    by using the knowledge I gained by bucky (untill now) I managed to create this:
    #include
    using namespace std;
    int main()
    { int password = 123456789;
    int z = 1;
    int x;
    cout

  • @dogukanarik5671
    @dogukanarik5671 3 года назад

    you are the best

  • @hildamartinez8778
    @hildamartinez8778 7 лет назад

    You would not need 5 different integers to save the cin values?

  • @saravanan335
    @saravanan335 Год назад

    Well explained

  • @surenderjakhar733
    @surenderjakhar733 7 лет назад

    The Best

  • @riteshtheunknown
    @riteshtheunknown 9 лет назад

    Super STUFF !!

  • @ideaexpert
    @ideaexpert 12 лет назад

    Whats so special about Bucky?
    Well, unlike many other foolish tutorial series, view count does not decreases as the program progresses!! :D

  • @ivandrofly
    @ivandrofly 11 лет назад

    Thanks! :D.... Really Helpful!

  • @mockingbird3809
    @mockingbird3809 7 лет назад

    #include
    using namespace std;
    int main(){
    int a = 1;
    int number;
    int total = 0;
    cout number;
    total = total + number;
    a ++;
    }
    cout

  • @mrbrush4994
    @mrbrush4994 9 лет назад +9

    its the best calculator in the earth lol

  • @bomer890
    @bomer890 13 лет назад

    @i3oges that's true...but the previous number will be same....

  • @mohiuddinopu
    @mohiuddinopu 11 лет назад

    if um not declaring total = 0, the final value of total is 2 short ( if the sum of 5 number is 10, but shows 8, ). whats the reason?

    • @1234321jack
      @1234321jack 11 лет назад

      When you define a new variable, your telling your computer to pick a small piece of memory to put something in. This piece of memory will have some old number left in it. If you don't set the variable equal to something, it will stay set as the old random number as default. So, in your case, the piece of memory total was assigned to had -2 left in it, and since you didn't reset it to 0, this subtracted 2 from the total.

  • @ClaudiuB
    @ClaudiuB 7 лет назад

    I wonder when your tutorials gonna stop?!?!?! cuz I have work to do and I can't just stop hitting next vid :D 10x

  • @sidrockx95
    @sidrockx95 11 лет назад

    You are talking about c++ shorthands!

  • @mahdihusainmomin
    @mahdihusainmomin 9 лет назад

    thanx bucky

  • @vailynx
    @vailynx 12 лет назад

    What if I want to show me al the numbers that I introduced in ascending order??