C++ Programming Tutorial 14 - Creating Void Functions

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

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

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

    Learn Javascript - bit.ly/JavaScriptPlaylist
    Learn Java - bit.ly/JavaPlaylist
    Learn C# - bit.ly/CSharpTutorialsPlaylist
    Learn C++ - bit.ly/CPlusPlusPlaylist
    Learn C - bit.ly/CTutorialsPlaylist

  • @elipsem1008
    @elipsem1008 4 года назад +46

    0:24 great transition lol

  • @kromydas5063
    @kromydas5063 3 года назад +21

    I love how you sponsor Embarcadero but use Visual Studio Codes.

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

      Right? Lol

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

      @@luludiy7808 yeah xD

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

      it's because he's on mac

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

      tbf you only need visual studio for ide and vscode for text editor as visual studio is great for an ide AND is directly supported by microsoft, and vscode is just top tier for text editing.

  • @shscotthoffman
    @shscotthoffman 4 года назад +14

    This was way more fun and easier than the past two videos lol
    I use 'bananapower' for the improvised 'pow' since it shows up in visual studio as yellow

  • @CristiansProduction
    @CristiansProduction 3 года назад +3

    im struggling in my computer science class this video helps out a lot thanks

  • @shanebenlolo4866
    @shanebenlolo4866 5 лет назад +9

    You rock, these videos are helping immensely. Thanks for making them!

  • @nhanvu1566
    @nhanvu1566 3 года назад +2

    you're god sent. You explained much much better than my PhD. professor @ GaTech!! I could have passed the class on the 1st try if your vids were available sooner XD

  • @ModifiedMike
    @ModifiedMike 3 года назад +2

    I'm loving these, but question for you! :)
    You basically explained the algorithm to this function, but what does each thing mean? I'll explain..
    double result = 1;
    for(int i **What does this letter i mean, what is its value?** = 0; i < exponent; i++ **what is i++ mean, what is the purpose?** )
    {
    result = result * base;
    }
    return result;
    }
    I understand the return result and multiplying the base, but i am so confused to the integer i and the i++

    • @FreakinfreakInfreaki
      @FreakinfreakInfreaki 3 года назад +5

      This took me a while to figure it out as well. I'll try to explain it via text as best I can.
      A for loop has a few different parts. Initialization, condition, code inside loop, update counter and false/stop.
      So int i is necessary in order for the for loop to function so he declared and initialized inside the parenthesis with int i = 0. This is the initialization of a for loop. By the way the letter doesn't have to be i it's probably just a programming standard for for loops.
      The loop then takes int i and checks if it is less than the exponent. For example if your exponent is 3 and and int i = 0 then 0 is of course less than 3. This is the condition part of a for loop.
      Now the code inside the loop happens. In this instance result = result * base;
      Finally is the update counter which is where i++ comes in. ++ is an increment operator which just means to add 1 to int i. So now int i = 1.
      The loop then runs again. Now int i = 1. But as my previous example 1 is still less than 3. Code inside loops happens, then i++ so now int i = 2. If you want to see the increment operator in action put inside the for loop and it will print to console each increment.
      {
      result = result * base;
      std::cout

  • @arlindoferreira2067
    @arlindoferreira2067 5 лет назад +4

    Good explanation, I have just started to learn how to program in C++.

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

    That was a smooth promotion, love your vids man!

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

    Thanks for another amazing video! I could make a lot of puns here, but I'll go with saying that void functions have shaped many concepts in programming. There is a "legacy of the void", you could say.

  • @atharvaparikh8310
    @atharvaparikh8310 4 года назад +5

    very nice product placement using C++ to fill the void in our lives.
    That's what every programmer wants lol : )

  • @isaacmills1200
    @isaacmills1200 4 года назад +4

    The thing that itches me the most about these videos is that you keep telling us about Embarcadero and how good it is as a C++ IDE, and then proceed to use VS Code despite the fact that this Embarcadero is allegedly free. Is there a reason for this?

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

      lul ikr

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

      maybe because VSCode is better for teaching that way, and Embarcadero is better for real development

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

      because VSCode is not an IDE, it is just a code editor. The equivalent to Embarcadero is Visual Studio which is an IDE. IDE are more difficult to understand, especially for beginners, so that is why he uses VS Code

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

      @@sentfromheaven00 si si si

  • @parsaai2362
    @parsaai2362 3 года назад +3

    I really like your videos because they are very useful and besides, you teach really good! I got a question. In what level of c++ programming will I be after I finish this course? I know that being a good programmer requires a lot of experience along with the knowledge. But I wanna know is this course complete in terms of the knowledge or do I have other things to learn afterwards?

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

      u probably passed the void myFunction() but i think its after (while)

  • @giaprasad1779
    @giaprasad1779 4 месяца назад

    So the void function is used to print values and do declarations only?? And not perform any calculations

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

    Hi, there. What would you say is the best compiler to use for c++?

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

    Since main no longer returns anything can we call it "void main()" ?

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

    That ending music slaps

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

    nice ad segment

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

    Dear Caleb if I type directly in the main function as printPow(pow(base, exponent)) is it correct ?

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

      I don't think that will work, but I think the best way to find out is to code it yourself. You can test it out quickly in browser-based compilers, like this one ( www.onlinegdb.com/online_c++_compiler ).

  • @kerima4luv
    @kerima4luv 8 месяцев назад

    Thanks for this now you filled up the void about Void😂.

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

    Hey man, could you please help me, the first 2 lines that is #include and #include showing as an error in Microsoft visual studio. The red line is underlined, can you explain why is that happening, My system is WI does 10 32bit.

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

    hello curry, you did declared inside power function but at the end of the video you declared it again inside int main. Is it a mistake or is it because you created void function?

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

    17:17 oh yeah!!!

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

    Start at 1:05

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

    What does this mean?
    Double myPower =
    power(base, exponent)
    I don't see any computation program but How does it calculate?

    • @m-a921
      @m-a921 3 года назад +2

      Well, Hi. Look. base and exponent are user inputs which mean they are the numbers the user inputs.
      pow(base, exponent) means that if you input 5 for base and input 2 for exponent, the machine multiplies 5 by 5 (5*5) and gives the result. Another example is that if base = 5 and exponent = 4, this means 5*5*5*5* which is equal to 625.

  • @good-tn9sr
    @good-tn9sr 3 года назад

    Why dont you use "using namespace std:" in your header?

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

      Bad practice, creates a lot of trouble for compiling.

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

    Thanks 🙏🏽 subbed

  • @itsAnaMC
    @itsAnaMC 4 года назад +2

    double bass

  • @Igrium
    @Igrium 8 месяцев назад

    Amazing sponsor segway lol

  • @matthewadu9232
    @matthewadu9232 4 года назад

    I keep getting 100 instead of 1000 whenever i run the code. I'm not sure what i'm doing wrong.

    • @rishik7665
      @rishik7665 4 года назад

      try recompiling it first!

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

      Matthew Adu try to check if in your for-loop you initialized ‘i’ as 1 or 0, and if you used a < or a

  • @sameerrasam5533
    @sameerrasam5533 4 года назад +2

    allriiiiiiiiiiiiiiight

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

    Wow. A lot of people have given up.

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

    why isn't 'main' a void function?

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

      You can return a status to say if everything went ok

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

    nice segue

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

    I do have a void in my life lolol

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

    they pay you like 1M to promote them !? 😂

    • @kromydas5063
      @kromydas5063 3 года назад +3

      The funny thing is that he uses VS codes or visual studio codes instead of Embarcadero even though he said it was free........

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

    i do have a void in my life.. :(

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

    TY FOR VIDEO U HELPED ME OUT