Buckys C++ Programming Tutorials - 18 - while Loops

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 เม.ย. 2011
  • Source Code: github.com/thenewboston-devel...
    Core Deployment Guide (AWS): docs.google.com/document/d/16...

ความคิดเห็น • 369

  • @halleyhart7161
    @halleyhart7161 4 ปีที่แล้ว +126

    Yoo bucky bucks, cool tutorials. Still here 2020

    • @anthonystevens6999
      @anthonystevens6999 3 ปีที่แล้ว +15

      Still here 2021

    • @Sakura69
      @Sakura69 2 ปีที่แล้ว +3

      Still here 2022

    • @saku-ra8813
      @saku-ra8813 ปีที่แล้ว

      Still here 2022 almost 2023

    • @themask7795
      @themask7795 ปีที่แล้ว

      Now 2023 like if you still here❤

    • @oriavni3622
      @oriavni3622 3 หลายเดือนก่อน

      2024

  • @laurelclementedinopol3615
    @laurelclementedinopol3615 8 ปีที่แล้ว +213

    Damn... I've been watching your tutorial and I've learned a lot than staying in my classroom.. best part is.... It's FREE! Thanks a lot buck

    • @__Suyash
      @__Suyash 8 ปีที่แล้ว +4

      +Laurel Clemente Dinopol my teacher wanna get me thinking that "damn ,my teacher is so smart" but nope.....

    • @Sisa095
      @Sisa095 2 ปีที่แล้ว

      same

  • @neversurrenderinlife
    @neversurrenderinlife 10 ปีที่แล้ว +189

    cout

    • @rogueonlict1740
      @rogueonlict1740 5 ปีที่แล้ว +1

      string name;
      cout

    • @dearshoberoi285
      @dearshoberoi285 4 ปีที่แล้ว +4

      Why not add that line in a while loop?

    • @rogueonlict1740
      @rogueonlict1740 4 ปีที่แล้ว

      @@dearshoberoi285 ok buddy
      thanks yo dope

    • @poorgang
      @poorgang 4 ปีที่แล้ว +4

      @@rogueonlict1740
      while(1){
      cout

  • @omarr.5371
    @omarr.5371 7 ปีที่แล้ว +13

    Bucky, you cannot begin to imagine how grateful I am for your tutorials. Thanks for the time you spent and all the work you put into them. Really! THANKS!

  • @pixies9145
    @pixies9145 3 ปีที่แล้ว +18

    Its strange he uploaded these videos when I were in grade 4,now I'm a university student ... amazingly, good effort to teach a lot of people .God bless u :)

  • @btc1668
    @btc1668 9 ปีที่แล้ว +13

    the best c++ teacher on youtube. thank you Bucky

  • @dee4960
    @dee4960 2 ปีที่แล้ว

    Thank you so much for these tutorials. You explain it so much better than my instructor.

  • @saifurrahman37
    @saifurrahman37 6 ปีที่แล้ว

    It was something that I had been looking for a couple of months.Thanks.

  • @nightcoreislove2029
    @nightcoreislove2029 7 ปีที่แล้ว +40

    you can use bacon++ instead of bacon = bacon + 1;
    bacon++ add 1 to bacon everytime bacon++ is called

    • @erlydeth99
      @erlydeth99 5 ปีที่แล้ว +11

      Could also use bacon += 1; if you're just looking for acceptable variants.

  • @thee_fairysister2329
    @thee_fairysister2329 11 หลายเดือนก่อน

    Thank you so much Bucky, your channel has made coding so fun and easy

  • @ninaramirez6237
    @ninaramirez6237 5 ปีที่แล้ว +2

    Some people are born to be helpful. Thanks a Lot bucky!!!!

  • @ethanviolet1
    @ethanviolet1 6 ปีที่แล้ว +5

    If you don't want to type: bacon = bacon + 1, you can type: bacon++ it is just a shorthand for incrementing by one.

  • @barinoodumcelestine1767
    @barinoodumcelestine1767 3 ปีที่แล้ว

    Hi Mr Buckys you are one in millions, you are just like a God sent. Thanks for all your tutorial videos, they're really good. God bless you.

  • @vectork3
    @vectork3 6 ปีที่แล้ว

    Thanks bucky you are master at c++ ang teach very well I learned a TON of new things about c++ than my teacher!

  • @muhammadamirulasyraf5816
    @muhammadamirulasyraf5816 8 ปีที่แล้ว +12

    "Pretty cool huh".... hell yeah!!! thanks a lot man

  • @SNoCappidona
    @SNoCappidona 2 ปีที่แล้ว +2

    i love when bucky says "pretty cool, huh?"

  • @chemiller8814
    @chemiller8814 8 ปีที่แล้ว

    Thanks for the help going through programming fundamentals and this is helping

  • @nightfreespirit
    @nightfreespirit 10 ปีที่แล้ว

    Thank you for these great tutorials. Even I am Danish, I understand them and is learning :)

  • @joetomaselli8084
    @joetomaselli8084 11 ปีที่แล้ว

    An easy way to bypass this is to keep a log of what you learn. I have a folder for every 5 C++ videos, and in the folder is a word doc about a singular lesson. It helps!

  • @sourpatch_king
    @sourpatch_king 11 หลายเดือนก่อน

    great stuff mate! easy to follow and to replicate. Thank you for the help!

  • @jackturisma237
    @jackturisma237 11 ปีที่แล้ว +1

    In case you don't know you can also use "bacon++;" for adding one everytime you loop thru while loop

  • @keepcalmandgo6169
    @keepcalmandgo6169 ปีที่แล้ว

    OMG, it really worked. Thank you so much!!

  • @church778
    @church778 11 ปีที่แล้ว +5

    For those wondering, you can also increase or decrease by more than just one. You can use, for example, x+=2; which will increase x by 2 everytime its ran. Replace the + with each different operator sign for desired effect.

  • @weexism
    @weexism 9 ปีที่แล้ว

    Thank you!! You're awesome. You should be teaching my CS161 class.

  • @laroselcouth8522
    @laroselcouth8522 4 ปีที่แล้ว

    So useful for classes... thank you!

  • @maroofraktim293
    @maroofraktim293 5 ปีที่แล้ว

    The way you teach is awesome..

  • @bradtagegogona7076
    @bradtagegogona7076 6 ปีที่แล้ว

    yess !! this is exactly what i need !! Thanks buck...simply pro

  • @astraadamskhan1399
    @astraadamskhan1399 9 ปีที่แล้ว

    very helpful thank you love these tutorials

  • @MosaabMop
    @MosaabMop 10 ปีที่แล้ว +3

    thaaanx alot.helped alot keep going ;)

  • @creedgamer7138
    @creedgamer7138 3 ปีที่แล้ว

    wow Bucky your explanations are awesome.....

  • @nikitasingh2134
    @nikitasingh2134 3 ปีที่แล้ว

    Approx 2021, its going to be 10 years and everyone still watches these.

  • @stephaniemsegura09
    @stephaniemsegura09 3 ปีที่แล้ว

    Great job explaining!

  • @slamg478
    @slamg478 2 ปีที่แล้ว

    Hey bucky! Just want to say that im glad that i found your channel, today my lecturer said to me that im not gonna be a good programmer although that is my ambition, I hope that you all can wish me luck in the coming years !! Thanks🤕

    • @ferasyakan2558
      @ferasyakan2558 2 ปีที่แล้ว

      Don't listen to him and pursue your dream

    • @_0_restart_0_
      @_0_restart_0_ ปีที่แล้ว

      Good luck, Haziq!

  • @tamilanx
    @tamilanx 7 ปีที่แล้ว +13

    Pretty cool huh!!

  • @abboudashkar3804
    @abboudashkar3804 4 ปีที่แล้ว +4

    my teacher told us to watch your videos

  • @letsexecutecplusplus7261
    @letsexecutecplusplus7261 3 ปีที่แล้ว

    Bucky's all tutorial 👌👌👌 Still yet
    thanks Bucky

  • @vityabellic2983
    @vityabellic2983 3 ปีที่แล้ว +1

    helped me so much brother

  • @togmeister8604
    @togmeister8604 9 ปีที่แล้ว +72

    Lol? Why is your project in a folder called Watermelon.

    • @SLRNT
      @SLRNT 9 ปีที่แล้ว +9

      Togmeister he's doing these tutorials the fun/creative way, calling classes bacon, apples etc :)

    • @SLRNT
      @SLRNT 9 ปีที่แล้ว +8

      Togmeister he's doing these tutorials the fun/creative way, calling classes bacon, apples etc :)

    • @SLRNT
      @SLRNT 9 ปีที่แล้ว +6

      Togmeister he's doing these tutorials the fun/creative way, calling classes bacon, apples etc :)

    • @logerer5633
      @logerer5633 9 ปีที่แล้ว +7

      MasterSteve26 And you've posted this three times :P

    • @SLRNT
      @SLRNT 9 ปีที่แล้ว +5

      TH-cam app on a smartphone... y'know, imma delete them :D edit: wut :DDD can't even delete them :DD

  • @RealGamingZz
    @RealGamingZz 9 ปีที่แล้ว +17

    If you wanna add 1 to bacon, you could just write bacon++ right?

    • @1990jmv
      @1990jmv 9 ปีที่แล้ว +2

      yes

    • @beri4138
      @beri4138 7 ปีที่แล้ว +2

      Or ++Bacon. Does the same thing.

    • @Silentstrike46x
      @Silentstrike46x 6 ปีที่แล้ว +13

      @Gaming Turkey,
      Slight difference: If you are doing multiple steps in one, the location of the "++" can lead to different outcomes. If the '++' is before the variable, it will increment the variable before using it, not after. For example:
      bacon = 10
      Cout

  • @a99023029
    @a99023029 5 ปีที่แล้ว +1

    勉強になりました。Thanks

  • @briansummers2670
    @briansummers2670 10 ปีที่แล้ว +11

    Now teach us bacon++

  • @coreydoyle4702
    @coreydoyle4702 11 ปีที่แล้ว

    It's very nearly a complete university for FREE! THIS is the future of education. Free, Open-Source, and Collaborative.
    Universities and Colleges? Archaic institutions from the past.
    -Cheers

  • @jesusiskingofkings4428
    @jesusiskingofkings4428 6 หลายเดือนก่อน

    thank you good sir and God bless everyone

  • @1USF
    @1USF 7 ปีที่แล้ว +6

    thumbs up you worth it

  • @metznimbo29
    @metznimbo29 13 ปีที่แล้ว

    @crjacinro Id keep wacting this one, I hav watched the other one for dev C++ (not codeblocks) and this one is a lot better and MUCH longer

  • @2k6brandon
    @2k6brandon 12 ปีที่แล้ว

    At the end of the while loop what is the value of bacon? example: at 3:14, if you were to use the variable bacon after the while loop, would bacon still be 0 or would it be changed to 6?... If you were to cout

  • @steve122288
    @steve122288 8 ปีที่แล้ว +2

    gad damn. Searching syntax led me on a never ending wikipedia adventure, yet again.

    • @Aydin97
      @Aydin97 8 ปีที่แล้ว +1

      haha same here

  • @ahmermirza
    @ahmermirza 7 ปีที่แล้ว

    Man you must love bacon haha! :D thank you for the tuts!

  • @TheLostEggroll
    @TheLostEggroll 6 ปีที่แล้ว

    wow, now i understand how video game exploits work
    thnx!

  • @morxh8386
    @morxh8386 9 ปีที่แล้ว

    BEST.TEACHER.EVERRRRRRRRRRRRRRRRRR

  • @Boomerlance
    @Boomerlance 12 ปีที่แล้ว

    yup,thats another alternative,but the tutorial was about the while loops..
    personally,i think that while and for are basically the same thing,but for is better in more complex programs and the while loop's better in simple programs IMO...

  • @nazliguleryuz4819
    @nazliguleryuz4819 6 ปีที่แล้ว

    Hello I keep getting use of undeclared identifier 'cout' and use of undeclared identifier 'endl' why is that and i wrote exactly same code as you did.

  • @saravanan335
    @saravanan335 ปีที่แล้ว

    Super explanation

  • @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...

  • @emiliachan2021
    @emiliachan2021 9 ปีที่แล้ว

    hmmm, how about while nested loop? where can i put the increment ?

  • @dragonspeed99
    @dragonspeed99 5 ปีที่แล้ว

    I need some help, I understand how to do this, but what am i making bacon equal to, isnt bacon apart of an integer that equals 0?

  • @jrarmas321
    @jrarmas321 8 ปีที่แล้ว +1

    I like how people are posting their codes, while i can't understand all of it I Sure will sooner or later.

  • @joelsanchez3250
    @joelsanchez3250 5 ปีที่แล้ว

    Bucky is fantastic !!!!

  • @kezzibaba
    @kezzibaba 9 ปีที่แล้ว +1

    BUCKY IS THE BEST!

  • @weexism
    @weexism 9 ปีที่แล้ว

    Is there a way to capture the number of times the loop iterates?

  • @Boomerlance
    @Boomerlance 12 ปีที่แล้ว +1

    Instead of putting
    bacon = bacon + 1;
    you could have simply used:
    bacon++;
    way easier,this is called a COUNTER,it increase one unit to the variable once the first loop ended and then it ask again until the while loop ends.
    other than that,great video,thanls to you,i know Java and C++
    in a few months imma learn visual basic......you know,college really know how to test your patiente =S

  • @collinsowusu-agyemang7688
    @collinsowusu-agyemang7688 11 ปีที่แล้ว

    hi bucky, u the most outstanding tutor of all time !!! I'm "green" whn it comes to programming but your videos are getting me onboard now.
    Do u by chance have a video tutorial for Xcode for beginner like me?

  • @__da1m__
    @__da1m__ 9 ปีที่แล้ว

    hey bucky i noticed that if i write the code exactly the way you wrote it except for the while part which i wrote while (bacon = 0) the program does nothing. I guess it might have something to do with return 0; thing but care to explain

  • @enanaalr3117
    @enanaalr3117 8 ปีที่แล้ว

    i am trying to make a simple calculator allow to the user to enter how many number her/she wants. it goes well from the out side but when it start the calculation it gives a wrong result to the numbers
    i used these cods if you can help me please to know where is the mistake
    #include "stdafx.h"
    #include
    #include
    using namespace std;
    int main()
    {
    char operator_symbol, decision;
    float loopcount = 0, howmanynumbers, number, total = 0;
    decision = 'y';
    while (decision == 'y')
    {
    cout > howmanynumbers;
    while (loopcount < howmanynumbers) {
    cout number;
    cout > operator_symbol;
    loopcount = loopcount + 1;
    }
    switch (operator_symbol)
    {
    case '+':total = total+ number;
    break;
    case '-':total = total- number;
    break;
    case '*':total = total* number;
    break;
    case '/':total = total/ number;
    break;
    default:cout

  • @HowToCompute
    @HowToCompute 8 ปีที่แล้ว

    Hi, I would like to point out for what you are doing here a for loop is better suited. So instead of typing bacon = bacon + 1; bacon++; (will increment by one) or bacon += 1 (will add 1 to the value, can also be another value than 1, also possible as -= to subtract!)!

  • @zeonos
    @zeonos 12 ปีที่แล้ว

    you can also do "bacon++;" it will add 1 for each pass.

  • @TheHTMLCode
    @TheHTMLCode 12 ปีที่แล้ว

    yes you can, I think bucky is just demonstrating in its most basic form for those who find these abreviations hard

  • @iXenoCider
    @iXenoCider 12 ปีที่แล้ว +1

    Well for loops have much more power then while loops, let me show you.
    Say you have an array of names, you could put this in a for loop
    for(int i =0; i < NamesLength; i++)
    {
    cout

  • @Tanskinny
    @Tanskinny 12 ปีที่แล้ว

    @Raneman25 They do the same thing, but his way uses more code, hence why I said "more efficient".

  • @artistalreem1180
    @artistalreem1180 5 ปีที่แล้ว

    Write a C++ programme that reads a sequence of integers terminated by zero value then finds the percentage of the negative numbers and the percentage of the positive number in the sequence. The programme output is as shown: :
    Enter a sequence of in integers terminated by zero
    6 -7 -8 10 -12 14 15 2 -6
    the percentage of negative numbers is 44.4
    the percentage of positive numbers is 55.6
    Please help me to solve this problem

  • @samanshahid8836
    @samanshahid8836 6 ปีที่แล้ว

    when i watch these tutorials i learn stuff but if a teacher give me a program to write code for, i dont know what to do . I mean i cant make programs on my own. Plz help if someone knows how to master the logic for any program.

  • @herantd
    @herantd 8 ปีที่แล้ว

    for instance if you working on code for your microcontroller you want a loop run for ever. like pulsing LED on the arduino.

  • @2marshtomp
    @2marshtomp 12 ปีที่แล้ว

    Umm Bucky I have a problem wih the program. Every time I want to make a new "program" I need to make a new project and start all over. If I just delete the lines I made and write the new ones it sais "Project *path to file here* cannot be saved..." and when I run it, it runs the old program. How do I fix that?

  • @jonathan35587
    @jonathan35587 11 ปีที่แล้ว

    thanks, your video helped

  • @OldAlley
    @OldAlley 2 ปีที่แล้ว +2

    My only issue is, there can never be enough bacon..

  • @singh123416
    @singh123416 7 ปีที่แล้ว

    can you add a negative number ? just wondering

  • @filippogiovanatto1274
    @filippogiovanatto1274 4 หลายเดือนก่อน

    tnks man !😎

  • @SuperSneakyPanda
    @SuperSneakyPanda 12 ปีที่แล้ว

    @benningtonguySTUDIOS ++bacon will add 1 to bacon before evaluating it. bacon++ will evaluate it as bacon THEN it will increment bacon.

  • @mikeduels
    @mikeduels 13 ปีที่แล้ว

    So i did the while loop thing, still tryng to figure out how to make it stop :(

  • @calccalccalc
    @calccalccalc 13 ปีที่แล้ว

    Just a tip:
    A tidier way of adding 1 to a variable is:
    x++;
    Just so ya know ;D

  • @itskills1047
    @itskills1047 4 ปีที่แล้ว

    i have subscribe your channel after watching this video:-).

  • @jenaboabu1946
    @jenaboabu1946 7 ปีที่แล้ว

    how do we program this series 7, 9, 14, 20, 27, 33, 42, 52, 63, 73, 86, ...

  • @nessriensayed9029
    @nessriensayed9029 7 ปีที่แล้ว

    how could i make a calculator that you can enter any number of numbers you want by while loop and it stops when you press " = " i wrote ( char x ) and then made the condition in the while loop (char != " = " ) but it did't work and the was an error , and that was my last idea , witch failed

    • @taylorbeeston7367
      @taylorbeeston7367 7 ปีที่แล้ว

      use single quotes instead of double quotes around '='

    • @Phoenix-ox2jr
      @Phoenix-ox2jr 7 ปีที่แล้ว

      nessrien sayed youre trying to make it in a while loop, which can be a bit difficult. What you could do is use recursion. Recursion is when you make a function call itself so that it keeps going similar to a while loop. So you could write something similar to:
      void getNum(){
      int i=0;
      vector number;
      string choice;
      cout > choice;
      if(choice=="yes"){
      cout > number[i];
      i++;
      addNum();
      }
      //This will call itself after you use it until you answer anything other than "yes".

    • @Phoenix-ox2jr
      @Phoenix-ox2jr 7 ปีที่แล้ว

      nessrien sayed actually if you really wanted to do it with a while loop you could have cin>> amountOfNums and then while(x

  • @cabreram.4734
    @cabreram.4734 4 ปีที่แล้ว

    But what if I wanted to print only the value of bacon all those times but not changing the value of the increment while printed out. Only print it 20 or whatever times?!

    • @nathansuarez5543
      @nathansuarez5543 4 ปีที่แล้ว

      Use 2 variable. 1 for increment 1 for bacon

  • @kyrous10
    @kyrous10 12 ปีที่แล้ว

    woww dude...you are a genius LMAO!!!

  • @sniped101
    @sniped101 12 ปีที่แล้ว

    why is it that when I compile it and set it to print bacon to 222,222 and then i do the same thing in python... Python goes faster? I thought python was slower than c++.... it finishes 21 seconds faster than c++ programming of the same kind... ( both counting to 222,222)

  • @AnkitVerma-bs2qt
    @AnkitVerma-bs2qt 3 ปีที่แล้ว

    Sir bacon ki jgah or Kuch bhi likh sakte h kya

  • @siddhartharora5782
    @siddhartharora5782 9 ปีที่แล้ว

    How is it different from the for loop??
    for (int bacon=0; bacon

  • @__Suyash
    @__Suyash 8 ปีที่แล้ว +2

    guess what !!,i made an freaking bomb timer !!!BOOOM

  • @andeng2425
    @andeng2425 3 ปีที่แล้ว

    Thanks man

  • @ashishdubey94
    @ashishdubey94 12 ปีที่แล้ว

    Thanks again

  • @videogameaddict68
    @videogameaddict68 8 ปีที่แล้ว

    What's better for the while loop here? bacon = bacon + 1....... or bacon++?

  • @bobby-oi7jb
    @bobby-oi7jb 2 ปีที่แล้ว

    Thanks, bucky. Hope ur bacon tastes good

  • @brunogatete6069
    @brunogatete6069 9 ปีที่แล้ว

    Well expained

  • @defalergod
    @defalergod 11 ปีที่แล้ว

    While this is useful you can only do it once, for instance.
    cout

  • @LordOfGilneas
    @LordOfGilneas 11 ปีที่แล้ว

    and what if you need to add more than that? sure, you could add more counters, but that takes up space.

  • @montecarlomoney5689
    @montecarlomoney5689 11 ปีที่แล้ว

    You need to start Bucky School of Computing

  • @neettim
    @neettim 9 ปีที่แล้ว

    do you have a video on counters?

  • @407mrREN
    @407mrREN 3 หลายเดือนก่อน +1

    man, this guy really loves bacon.

  • @dawnbugay7094
    @dawnbugay7094 6 ปีที่แล้ว

    Thank u buck