C++ Ternary Operator (Conditional Operator) | CPP Video Tutorial

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

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

  • @IrfanAli-mg9gf
    @IrfanAli-mg9gf 9 лет назад +26

    I have gained more knowledge by watching your videos than referring books written by top Authors..!!Awesome Tutorials and keep doing the good WORK.!!

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

      +Irfan Ali
      happy to hear that.
      Thank you :)

  • @ok-dt8db
    @ok-dt8db 8 лет назад +12

    i did it #include
    using namespace std;
    int main()
    {
    int mark;
    cout > mark;
    mark >=35 ? cout

  • @SpreakYT
    @SpreakYT Год назад +1

    Thanks for it 😊

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

    I watched all the videos in c++.... learned a lot...even have more clarity than before.... thanks a lot... good work.. God bless you

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

    Watching this in 2020 and still it is the best tutorials that you can find online.

  • @robertfaubion1311
    @robertfaubion1311 6 лет назад +7

    I really appreciate your lessons. You are excellent in teaching. Thanks for all the effort.

  • @aliyakubu6449
    @aliyakubu6449 6 лет назад +4

    Great delivery.The first time I understood this concept of ternary very well.Keep the it up..

  • @ibrahimshamaal3733
    @ibrahimshamaal3733 4 года назад +6

    thank you ma dude. you finally helped me to figure out my homework.

  • @robertfaubion1311
    @robertfaubion1311 6 лет назад +7

    Will you ever do an OpenGL tutorial series? The internet needs your teaching style for such an advanced topic!! :)

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

    I understand better by watching your posted video than study book
    Therefore,i am very grateful to you.........

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

    holy shit, im glad i found these tutorials. I hope to soon be a c++ master with your tutorials. thanks man!! did you go to school for this?

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

    omg thanks m8 cheers!
    1 question in my mind answered by watching this

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

    It Is too good for understanding ❤❤❤❤❤

  • @cororolyune4127
    @cororolyune4127 9 лет назад +2

    I love this dude! Keep up the good work!

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

    thanks a lot anil thats a wonderful explaination

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

    What if we have more than two conditions? like If, else if and else? could you please explain?
    Reply 2

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

    Sir, which software do you use to run these kind stuffs???

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

    Hi when to use ternary over separate function? For example i have 3 different condition check in a function, can i use 3 ternary or 3 sub functions?

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

    Only good for const veriables that need only two statements, you should still refer to (if else) conditions for clarity, readability and testing.

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

    awesome....very helful plzz keep uploading such videos

  • @arunblaze8002
    @arunblaze8002 8 лет назад +4

    Can ternary operator have nested form like in if-else operator ?

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

    Extraordinary work brother

  • @rectuserectus6164
    @rectuserectus6164 9 лет назад +4

    Great video! Whats the name of the program you use to write cpp?

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

      +Rectus Erectus
      im using codeblocks ide :)

    • @rectuserectus6164
      @rectuserectus6164 9 лет назад +1

      Thanks!

    • @rectuserectus6164
      @rectuserectus6164 9 лет назад +1

      ***** I am experiencing an issue with codeblocks. whenever I press build and run, it doesn't do anything.

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

      +Rectus Erectus
      what error you are getting????
      did you installed codeblocks along with mingw or what???

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

      +LearningLad
      i mean to say did u get any warning etc????

  • @alimam.7399
    @alimam.7399 2 года назад +1

    thank u a lot
    i got it from the first watch

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

    which editor do you use?

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

    Can you use this method to make nested if...else statements? It seems like you can, you just have to make another evaluating expression after the ':'. Or, am I wrong about this. The only thing I see is that it might get confusing.

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

      yes we can use them. you can avoid the confusion if you indent the code properly.

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

    When would you recommend (or not) programmers to use ternary operators instead of the basic else-if statements?

    • @IrfanAli-mg9gf
      @IrfanAli-mg9gf 9 лет назад +1

      +Cindy Yap The ternary operator does the work of a basic if-else in a single line making the code less complicated to understand.

  • @yobraFx
    @yobraFx 9 лет назад +1

    which is more efficient to use...this one or if else?

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

      Generally, Ternary operators are preferred over if-else as they just round-up the whole nested if-else code in just 1 statement, and are easy to understand / less complicated.

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

    you r doing a good job...
    i m too much week at prgrmng.. getting infrmations from u..
    but here is a prblm i cant see the prgrame clearly...

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

      thank you and i'm really glad that my tutorials are helping you.
      try to watch the video's in 1080p.
      we have solved this problem in our latest video's but the issue still exists in some of our old video's and i'm really sorry about that.
      Keep Learning :)

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

    my output screen is not holding in codeblocks..please tell me how to hold it??

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

    you are the best !!!!

  • @shivamsharma-wu4ru
    @shivamsharma-wu4ru 6 лет назад

    hey sir,, plzz explain if there is multiple ternary operator used in a program in the same line

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

    hi
    if i use for loops for getting several numbers,how can i use question mark?

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

    Thx u so much

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

    Bro can we use this in c

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

    Is it possible to nest the ternary operator ( Like nested ifs)??
    If so can you please tell how to do it??

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

    can we use && / || operator in expn ???????
    (means Two conditions)

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

    Not using

  • @سارا-خ4ب4ق
    @سارا-خ4ب4ق 6 лет назад +1

    Great 👍🏻

  • @lokeshbajracharya5190
    @lokeshbajracharya5190 8 лет назад +4

    hey :)
    What if we have more than two conditions? like If, else if and else? could you please explain?

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

      reply anil plzz

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

      Use if - else if - else syntax

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

      else is always last as elif is a second if

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

    really awesome

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

    what is" return 0"for

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

    thanks man

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

    Thank you so much

  • @emilyforestier5959
    @emilyforestier5959 3 месяца назад +1

    TYSM

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

    thank u so much sir :)

  • @techgodrachit
    @techgodrachit 9 лет назад +1

    Good video

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

    THanks you so mcuh

  • @youssefel-shabasy833
    @youssefel-shabasy833 6 лет назад +1

    ty

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

    thanks

  • @Syvmana
    @Syvmana 9 лет назад +1

    Thanks dude.

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

    Good tutorial, it helps a lot. But perhaps you could have a tutor for teaching you better English XD. Sorry no offense meant by it, but instead of saying "You are passed in exam" and "You are failed in exam", English speakers would say "You have passed the exam" and "You have failed the exam"

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

      its ok.
      i get it.
      i'm working on it :)

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

      Imagine giving these tutorials in Hindi when your first language is English. That is the equivalent of what this guy is doing. Pretty amazing accomplishment, actually! :)

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

    Nyc class

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

    Thank you sir

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

    shukria

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

    Thank you for the tutorials. You are awesome tutor.

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

      my pleasure.
      keep Learning :)

  • @NoName-oq8ok
    @NoName-oq8ok 8 лет назад +2

    thanks thanks thaaaaanks

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

    Thanks alot

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

    Used ternary statement in cout

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

    n=100
    n-95?(n

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

    thanks
    but u should also help us understand other ways do the same thing with ternry operators

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

    thanks brazar

  • @coralmary35
    @coralmary35 9 лет назад +2

    how to use ternary operator for more than 2 variables :D

    • @LearningLad
      @LearningLad  9 лет назад +4

      coral
      i think you are asking about using 2 or more variables to form the condition.
      Use the logical and comparison operators in the condition.
      use parenthesis to group it.
      example
      #include
      using namespace std;
      int main()
      {
      int mark, avg;
      cout 20) ? cout

    • @coralmary35
      @coralmary35 9 лет назад +1

      thank you so much... that's what exactly I was looking for.... I always have problem with the parenthesis.... thanks again :)

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

      coral :)

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

    btw u can do // to write a comment

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

    sir you are right but you are passed in exam is not correct grammer lol

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

      i'm trying to improve.
      English is my 3rd language :)

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

      @@LearningLad You know three that's impressive. I want to learn a second one day.

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

      awesome :)

  • @mominuber
    @mominuber 9 лет назад +1

    //done
    #include
    using namespace std;
    int main()
    {
    int mark;
    cout > mark;
    mark >=45 ? cout

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

    thanku so much sir!!

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

    thank you so much

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

      my pleasure.
      keep learning :)