ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก
C++ Ternary Operator (Conditional Operator) | CPP Video Tutorial
ฝัง
- เผยแพร่เมื่อ 12 ส.ค. 2024
- In this c++ / cpp programming video tutorials / lecture for beginners video series, you will learn about the ternary operators with example.
You will lean what are the ternary operators and also how to use them in your program, how a ternary operator can be used as alternative to simple if and else in detail with examples.
Visit www.LearningLad.com to get the SOURCE CODE of this tutorial and to watch more free computer programming video tutorials.
Learn Programming in HINDI at our youtube channel
/ learningladhindi
Catch us on Social Media
/ learninglad
www.google.com/+LearningLad
/ learningladedu
I have gained more knowledge by watching your videos than referring books written by top Authors..!!Awesome Tutorials and keep doing the good WORK.!!
+Irfan Ali
happy to hear that.
Thank you :)
i did it #include
using namespace std;
int main()
{
int mark;
cout > mark;
mark >=35 ? cout
I really appreciate your lessons. You are excellent in teaching. Thanks for all the effort.
my pleasure.
keep learning :)
Watching this in 2020 and still it is the best tutorials that you can find online.
I watched all the videos in c++.... learned a lot...even have more clarity than before.... thanks a lot... good work.. God bless you
thank you.
keep learning :)
Great delivery.The first time I understood this concept of ternary very well.Keep the it up..
awesome.
keep learning :)
thank you ma dude. you finally helped me to figure out my homework.
my pleasure :)
awesome....very helful plzz keep uploading such videos
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?
It Is too good for understanding ❤❤❤❤❤
omg thanks m8 cheers!
1 question in my mind answered by watching this
Will you ever do an OpenGL tutorial series? The internet needs your teaching style for such an advanced topic!! :)
i'll try :)
I love this dude! Keep up the good work!
+Cororo Lyune
thank you :)
I understand better by watching your posted video than study book
Therefore,i am very grateful to you.........
Thanks for it 😊
really awesome
thanks man
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?
THanks you so mcuh
thanks a lot anil thats a wonderful explaination
My pleasure :)
hi
if i use for loops for getting several numbers,how can i use question mark?
What if we have more than two conditions? like If, else if and else? could you please explain?
Reply 2
Only good for const veriables that need only two statements, you should still refer to (if else) conditions for clarity, readability and testing.
Good video
hey sir,, plzz explain if there is multiple ternary operator used in a program in the same line
Nyc class
ty
thank u a lot
i got it from the first watch
most welcome :)
Is it possible to nest the ternary operator ( Like nested ifs)??
If so can you please tell how to do it??
Extraordinary work brother
thank you :)
you are the best !!!!
not yet :)
When would you recommend (or not) programmers to use ternary operators instead of the basic else-if statements?
+Cindy Yap The ternary operator does the work of a basic if-else in a single line making the code less complicated to understand.
my output screen is not holding in codeblocks..please tell me how to hold it??
Thanks alot
Most welcome
Thx u so much
Pleasure :)
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...
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 :)
Thank you sir
Welcome
thanku so much sir!!
Pleasure :)
Thank you so much
welcome :)
Not using
thank u so much sir :)
pleasure :)
Thanks dude.
Syvmana
:)
Great 👍🏻
Thank you :)
thank you so much
my pleasure.
keep learning :)
thanks thanks thaaaaanks
+Aseel Aseel
:-)
thanks
my pleasure :)
what is" return 0"for
Can ternary operator have nested form like in if-else operator ?
you can nest the ternary operator.
Thank you Sir .
which is more efficient to use...this one or if else?
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.
Sir, which software do you use to run these kind stuffs???
i'm using codeblocks ide
shukria
Welcome
which editor do you use?
codeblocks ide
Great video! Whats the name of the program you use to write cpp?
+Rectus Erectus
im using codeblocks ide :)
Thanks!
***** I am experiencing an issue with codeblocks. whenever I press build and run, it doesn't do anything.
+Rectus Erectus
what error you are getting????
did you installed codeblocks along with mingw or what???
+LearningLad
i mean to say did u get any warning etc????
Thank you for the tutorials. You are awesome tutor.
my pleasure.
keep Learning :)
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.
yes we can use them. you can avoid the confusion if you indent the code properly.
thanks
but u should also help us understand other ways do the same thing with ternry operators
Used ternary statement in cout
yes you can :)
Bro can we use this in c
yes you can :)
n=100
n-95?(n
hey :)
What if we have more than two conditions? like If, else if and else? could you please explain?
reply anil plzz
Use if - else if - else syntax
else is always last as elif is a second if
btw u can do // to write a comment
how to use ternary operator for more than 2 variables :D
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
thank you so much... that's what exactly I was looking for.... I always have problem with the parenthesis.... thanks again :)
coral :)
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"
its ok.
i get it.
i'm working on it :)
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! :)
sir you are right but you are passed in exam is not correct grammer lol
i'm trying to improve.
English is my 3rd language :)
@@LearningLad You know three that's impressive. I want to learn a second one day.
awesome :)
//done
#include
using namespace std;
int main()
{
int mark;
cout > mark;
mark >=45 ? cout
can we use && / || operator in expn ???????
(means Two conditions)
yes you can :)