Learn C++ With Me #5 - Arithmetic Operators

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.ย. 2024

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

  • @jakubhorak636
    @jakubhorak636 3 ปีที่แล้ว +27

    11:48 you are right, normally it doesnt matter but in C++ it actually does matter. Because remember that 5/2 is not 2.5 but 2 in C++ and therefore (2*5)/2=5 != 2*(5/2)=4.
    EDIT: if you wanted to divide floats and get precise result just do 2 * 5 / 2.0

  • @mastershooter64
    @mastershooter64 3 ปีที่แล้ว +6

    6:53 "Still get 78 eh?" lol the Canadian inside you is peeking out

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

    I've noticed people in the comment section stating you should do a "C++ for Python Devs" series. I recommend doing that after this series, you'll obviously need to be somewhat fluent with C's syntax before making a series like that. And actually, I would prefer a Cython series over anything. I personally would only use C++ to extend or optimize my python software

  • @muddtheboss415
    @muddtheboss415 3 ปีที่แล้ว +6

    Although you're doing a great job, I would like to point out one thing. You don't need to include the string library to just declare a string. you can declare string by using only the iostream library. The string library only contains some functions needed to manipulate strings only and not necessarily needed if you are just declaring string like you did in previous videos. Also it is a good practice for beginners to not include the namespace std. by not using it, you will have to use std:: before a function that is declared in that namespace and it is better to know which functions are declared in the namespace or not. When you're learning, it's better to use the std:: as you will get an idea which function is in the standard namespace and which are not.

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

    Tim never fails to make a great tutorial

  • @KhalilYasser
    @KhalilYasser 3 ปีที่แล้ว +7

    Thanks a lot for your amazing tutorials.

  • @aitnez
    @aitnez 5 หลายเดือนก่อน

    how does this video have only 896 likes? You are helping me so much on college!!

  • @wojwesoly
    @wojwesoly 3 ปีที่แล้ว +12

    I think you should also show ++x and what is the difference between x++ and ++x

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

      I agree

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

      Can I ask what's the difference?

    • @wojwesoly
      @wojwesoly 3 ปีที่แล้ว +5

      @@loox758 iirc, ++x first increments and the does everything else (so couting, comparing etc.), while x++ first does the couting, comparing etc. and then increments

    • @lluism200
      @lluism200 3 ปีที่แล้ว +12

      @@loox758 They already answered but I'll try to exemplify it so it's easier to understand, if someone needs it:
      if your run:
      int x = 3;
      cout

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

      @@lluism200 That's so cool!

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

    I'm learning C++ in my degree and programming as a whole for the first time. Just want to say this is really helpful and very much thankful for this! Reading textbooks do not explain things so easily!

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

    Lol the BEDMAS caught me off guard. I learned PEMDAS which is the same thing in essence.

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

    no disrespect, but where did you go to school because i was taught pemdas(parenthesis, exponents, multiplication, division, addition, then subtraction)

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

    thanks tim! I'm taking a programming course in college right now and your videos are helping me out alot

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

    Thank you Tim for this series!!

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

    Thanks

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

    Merry Bedmas

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

    PEMDAS tim, PEMDAS!

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

    The exception at 11:54:
    6 / 2(1 + 2) = 3
    6 / 2(1 + 2) = 9

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

    So C++ is basically C + 1

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

    Amazing

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

    Advertisement: so do you want to be a software engineer at Google
    Me:YESSS!! Obviously!!!..

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

    Nice

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

    I was also expecting the modulo operator. Maybe it will come later...

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

      It’s in this video !

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

      Ah, it is at the end of this video. Thanks.

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

    I also do videos about programming!😁

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

    you have "BEDMAS"
    and here in india we have "BODMAS"

  • @par-th1
    @par-th1 3 ปีที่แล้ว +1

    Noice teaching
    You accidentally messing up shows how much of a beginner you are!

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

      i think you haven't seen the first video of this series.. he had clearly said he is learning by teaching us

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

      I actually appreciate the feedback and do concede to the fact that I am a c++ beginner. Hence the first video and title of the series, however I’m interested in what maybe I misunderstood. Would you mind helping me
      Improve and providing some examples of something that maybe exposed my level of inexperience ?

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

    you forgot floor division

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

    man, your audience are python guys. you should do smthng like "C++ for Python developers". just watching you explaining difference between int and string is kinda boringg

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

      don't get this toxic. just wanted to point that, most of your viewers would think like me.

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

      i totally agree man

    • @TechWithTim
      @TechWithTim  3 ปีที่แล้ว +5

      Totally understand, however to gain a new audience or introduce other people to programming that don’t start with Python I do
      Like to make videos like this :)

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

    ~85% of people have watched lesson number one but gave up on this lesson 0-0.

  • @Alphabet_-_
    @Alphabet_-_ 3 ปีที่แล้ว

    Worst C++ tutorial ever!