Hey Guys, if you want more such tech educational videos on this channel then please support me by subscribing to this channel & also share it with your friends as it helps me create more video content just for you ✌
@@SimpleSnippets oh dude you have no idea.. me and my squad just promoted your channel to the whole IS department because we all were able to score full on this topic that day !! Bro keep posting more videos
*Exceptions are unexpect problems. *Exception handling allows you to transfer control from one part of the program to another. *In C++, there are three keywords that handle exception handling: try, catch, and throw. *Try - A block of code containing other code that could potentially have an exception. *Catch - Handles the exception with some sort of solution. *Throw - Can be added anywhere after some kind of exception condition.
Glad you liked it buddy. Very happy to hear this. Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
Thank you so much buddy, really glad to hear this from you. Please do subscribe to this channel & share the content with your friends too. That will be the biggest help & support 😇
wouldn't a simple while (denominator == 0) loop that continues asking for input of the denominator without ending the program been a better solution than a try and catch solution that ends the program?
//whats the need of try throw catch if we can do the same without using it #include using namespace std; int main() { int denominator,numerator,result; coutnumerator>>denominator;
Thank you so much Maria🙏 Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
Thank you so much buddy. Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@@SimpleSnippets Yes ofcourse I will do that, Keep on sir, you are doing a great job, by helping IT students like me who want additional explainatory lessons.
bro when we use '" throw denominator " then the denominator value is passed to the ex variable?? how 0 comes after the sentence Exception Divide by zero not allowed.???
I had a doubt. When I typed this same program in my pc, I first made a mistake of typing the *result=n/d;* line before our *If statement.* (inside the try block) The code in the catch block did not get executed but the program also didn't crash, I was simply getting a blank as the output, what could have happened? When I run the same program without any try catch blocks, the program stops and crashes. That didn't happen but the catch code also didn't get executed.
I use turbo c++ and an error is being shown - undefined symbol 'try' and at the same line it shows statement missing... (I checked for the missing statement but all the semicolons have been put in it's right place) what should I do ?
But if user enter denominator as alphabets or special symbol then how can this program work ...u have to put some condition for alphabets and special symbol also ...if u found the logic then rply me
Yes ofcourse buddy, Infact I make the video tutorials in such a way that it is easy for students to prepare for their exams. Plus if you are preparing for your answers you can also checkout my C++ course on our official website link - simplesnippets.tech/courses/cpp-programming-tutorials-for-beginners/ Here you will find all the theory needed to prepare for C++ programming and also many other informational articles so make sure to bookmark the website 😇✌
I've been following your videos since quite a long now. Your videos are really helpful. 😁🤟 The only place where I faced problem was speed...maybe its just me, m always like thodasa halu bol... plsss 😅
Hey, thanks for the tutorial, I loved it. Just tell me one thing, when we have multiple exceptions, we need to have corresponding number of catch block. What my understanding says, after reading the books, is that whenever there are multiple exceptions, the datatype of the argument of the catch is matched with that of the exception thrown. Now, my question is, there are hardly 4-5 different types of datatypes in general so does that mean we can only handle that many exceptions explicitly? Isn't that a bit silly?
I didn't really get your question. There are many different types of exceptions. Also exceptions are objects so like if the parent class is exception and then we have different child classes. So if you want to handle multiple exceptions (which are many btw not a few and they're not basic data types) you can use one single parent exception class to handle them all ✌️
Thank you so much buddy ❤️ Umm not really. Already have way too many topics to be covered in line 😓😅 but sure maybe in future I'll cover advance parts ✌️😇
Simple Snippets no problem!❤️ thank you for all you do. I’m writing a notebook with all your tutorials to help me review and teach myself c++ gonna do the same for Java!
I want to ask one thing that I also write exceptionhandling in dev c++ because it wasn't working turbo c++ but I write iostream without .h but my teacher doesn't understand and deduct my marks because I didn't wrote .h. How do I explain her that I am right
+Nidhi Dubey You show her/him your code on Dev C++ IDE and show that it works. If she/he doesnt agree then no one can help it here. See turbo C++ and Dev C++ are 2 different IDEs with different compilers thus that difference. here's what I found as the basic difference : www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwikpqLT3vLWAhWCqo8KHbt5Au8QFggoMAE&url=https%3A%2F%2Fdiscuss.codechef.com%2Fquestions%2F48899%2Fdevc-help&usg=AOvVaw1p-aUSZiqQNlCLHoR2Ocrk see if your code is working then your professor should give you the marks.
Thank you so much buddy🙏 Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
Thank you so much Mansi. Glad to hear that this video helped you 😇 There are many videos on our channel. Do check them ✌️ And would request you to share the video with your friends too ✌️ And all the best for your exam 😇
That's great to know Monish, please do Subscribe to our channel as we have a lot tech educational content which you'll surely like. Also please do share our channel and videos with your friends too, that's the biggest help and support you can provide buddy ✌
I think you'll just have to change that preprocessor line as - #include and use void main () instead of int main () Also at the end of main function don't use the return 0 statement
Thank you so much buddy🙏 Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
Hey Guys, if you want more such tech educational videos on this channel then please support me by subscribing to this channel & also share it with your friends as it helps me create more video content just for you ✌
My exam is exactly after 3 hours and you just saved my 20 marks !
Thanks a ton man !
Glad it helped! Please do share the videos and channel with your friends too. Thats the biggest help and support you can give back to our channel!
@@SimpleSnippets oh dude you have no idea.. me and my squad just promoted your channel to the whole IS department because we all were able to score full on this topic that day !!
Bro keep posting more videos
Wow that's amazing! I'm so glad to hear this man. This is what motivates me to keep making more content for everyone 🤟😊
*Exceptions are unexpect problems.
*Exception handling allows you to transfer control from one part of the program to another.
*In C++, there are three keywords that handle exception handling: try, catch, and throw.
*Try - A block of code containing other code that could potentially have an exception.
*Catch - Handles the exception with some sort of solution.
*Throw - Can be added anywhere after some kind of exception condition.
A huge respect for this guy. Kudos man, I am now getting a clear example of exception handling.
Same. I've read numerous books and tutorials on it, but this gave me a clear example of what throw and catch are actually doing.
Thank you buddy 🤟 I'm glad I could make this topic easy 😊
i have watched many video of c++ but i didnot find any video usefull...... but your video are awesome bro ....best explaination ever ... thank you
Glad you liked it buddy. Very happy to hear this. Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@@SimpleSnippets yes sure bro. but make one another video on fstream anothers functions that how they work
bro ur english fluency and clarity impresses mee
The best explanation ever! A huge thanks to u😍
Thank you so much buddy, really glad to hear this from you. Please do subscribe to this channel & share the content with your friends too. That will be the biggest help & support 😇
hi brother. Please add finally() final() finalize() methods also in addition to this concept.. :)
Daamnn, that was a very good explanation man,Kudos, you've saved my exam
Glad it helped!
wouldn't a simple while (denominator == 0) loop that continues asking for input of the denominator without ending the program been a better solution than a try and catch solution that ends the program?
What if we simply do if denominator ==0 cout divisom not possible
Else result =........ ???
Then we dont need na exception handling concept
//whats the need of try throw catch if we can do the same without using it
#include
using namespace std;
int main()
{
int denominator,numerator,result;
coutnumerator>>denominator;
if(denominator==0)
{
cout
It was an easy example to explain the concept. You cannot use if else statement everytime for very large programs.
Absolutely correct Manish ✌️
because it is a terrible example.
Not in my whole college life I understood this until now. Thanks man really appreciate it.
What if we tried to write an exception handling code by simply using if-else conditionals? Is it going to cause more time complexity/memory usage?
If its a small program it doesn't matter much ✌
thanks brother,all was well but I also wanted to know types of exception and what are difference between them
Good question sheetal, here is a link to all the different types of exceptions & more theory details - simplesnippets.tech/cpp-exception-handling/
Please make a video on multiple catch Blocks in exception handling 🙏🙏🙏
i like your tutorials, clear simple,good for beginners like me, thanks for your effort, i'm really grateful
Thank you so much Maria🙏 Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
Hey Tanmay, We want more videos on exception handling...it's other concepts...could you plz make more videos on it? 😃
Awesome tutorial. You helped me a lot.
Glad it helped!
Perfect and simple explanation, Thanks buddy!!!!
Thank you sir this video really cleared my concept for exception handling
Most welcome Shradha. I'm happy to hear this from you. I would request you to please share the video with your friends too ✌️😊
Thank you, brother! This was a brilliant tutorial.
good explanation, Thank you Sir.
Thank you so much buddy. Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@@SimpleSnippets Yes ofcourse I will do that, Keep on sir, you are doing a great job, by helping IT students like me who want additional explainatory lessons.
I dont get how this is any better than just an if and else?
Like
If(denom == 0)
{
print(error)
}
else
{
do the division
}
Excellent Explanation!! Thank you very much!! 🙏
It was not executed.. simply taking inputs.. but not giving result, like one person comented.. could you please clarify my doubt
sir can you please tell why the default value of result is zero?
Why can't we use a simple if else condition to check if denominator is 0
It's just example to understand concept
this concept is for more complex problems
Thank You So much!! It was really helpfull in such short time
awesome bhai,thanks a lot,finally i get crystal clear with this example!!!!
Hey buddy, thank you so much for the positive comment buddy. Happy to hear this. Please share the video with your friends too 😇✌️
bro u killing it!!!thanks!!
Thanks buddy! Please do share the videos and our channel with your friends if you want to genuinely support me & our channel!✌😇
You >>>>>>>> my teacher!
❤️😊❤️
why does this thing exists, like we could do literally the same thing using if else, what's so diff about this topic
How would I handle a non integer being entered? Let's say I entered the letter A instead of a number.
Awesome stuff as always! Thanks man!
bro when we use '" throw denominator " then the denominator value is passed to the ex variable?? how 0 comes after the sentence Exception Divide by zero not allowed.???
Bro here the dinaminator is integer type. So in the catch block inside the brockets we have use int and then any variables.
Amazing! You are very competent...a great lecture, helped me a lot...Thanks
Glad it was helpful!
Are stack variables initialised to 0 by default? Only global variables are guaranteed to be 0 init right?
I had a doubt.
When I typed this same program in my pc, I first made a mistake of typing the *result=n/d;* line before our *If statement.* (inside the try block)
The code in the catch block did not get executed but the program also didn't crash, I was simply getting a blank as the output, what could have happened?
When I run the same program without any try catch blocks, the program stops and crashes. That didn't happen but the catch code also didn't get executed.
same problem
Perfect explanation.
Thank you so much buddy, please share the video with your friends too. Thats the biggest help and support 😇
I think while loop is much easier for this concept 🙂
is try catch can handle all errors like memory leaks buffer because of pointers?
Wonderfully explained .
Thank you so much buddy, Please do share this video with your friends too. Thats the biggest help and support 🙂
@@SimpleSnippets sure.
Are there more videos on exceptional handling on this channel?
@@anubhav0355 I don't think so, but you can check the playlists and explore more 😇🤘
@@SimpleSnippets yeah sure 🙂
Thank you so much bro🍀
I wanna ask that we can simply call if statement as denominator==0; 🤔
sir how about adding udemy courses as extracurricular courses is it worth it ?
this is a great video! thank you so much!!
I use turbo c++ and an error is being shown - undefined symbol 'try' and at the same line it shows statement missing... (I checked for the missing statement but all the semicolons have been put in it's right place) what should I do ?
I don't use turbo c++. Are you missing a catch statement? There has to be a catch statement with try. ✌
@@SimpleSnippets I used a catch statement
But if user enter denominator as alphabets or special symbol then how can this program work ...u have to put some condition for alphabets and special symbol also ...if u found the logic then rply me
Thankyou sir , you're a life saver 🚀💛
Thanks you very much sir your notes was helping me a lot
Most welcome my friend ✌️😊 I would request you to please share the videos with your friends 😋
@@SimpleSnippets definitely sir but you are not answered my question, why we use scope resolution
Here's some info - www.tutorialspoint.com/Scope-resolution-operator-in-Cplusplus
Thanks you sir
Can I write this all information in my exam
If I get Exception question
Yes ofcourse buddy, Infact I make the video tutorials in such a way that it is easy for students to prepare for their exams. Plus if you are preparing for your answers you can also checkout my C++ course on our official website link - simplesnippets.tech/courses/cpp-programming-tutorials-for-beginners/
Here you will find all the theory needed to prepare for C++ programming and also many other informational articles so make sure to bookmark the website 😇✌
I just love you , thanks
Thank You Well Explained
Ji what app your using for c++....????
I've been following your videos since quite a long now. Your videos are really helpful. 😁🤟
The only place where I faced problem was speed...maybe its just me, m always like thodasa halu bol... plsss 😅
video was perfect but in the end you should give us few excersice so that we can practice it
Thank you so much for the compliments buddy and yes more thanks for this wonderful suggestion 😇
Can this be used if string or char is entered in a integer variable?
Why this video is not available in the playlist 😩
is it necessary to put "datatype 'ex' " every time.... inside the catch parenthesis
No you can use any other name too. Typically its kept e or ex 😇
Hey, thanks for the tutorial, I loved it.
Just tell me one thing, when we have multiple exceptions, we need to have corresponding number of catch block. What my understanding says, after reading the books, is that whenever there are multiple exceptions, the datatype of the argument of the catch is matched with that of the exception thrown. Now, my question is, there are hardly 4-5 different types of datatypes in general so does that mean we can only handle that many exceptions explicitly?
Isn't that a bit silly?
I didn't really get your question. There are many different types of exceptions. Also exceptions are objects so like if the parent class is exception and then we have different child classes. So if you want to handle multiple exceptions (which are many btw not a few and they're not basic data types) you can use one single parent exception class to handle them all ✌️
Loved it! ☺️
Thank you so much I understand it better now!
Most welcome Kevin. Would be great if you'd share it with your friends as well 😇✌️
Simple Snippets I already did!☺️ are you planning to upload any swift tutorials or advanced c++ tutorials?
Thank you so much buddy ❤️
Umm not really. Already have way too many topics to be covered in line 😓😅 but sure maybe in future I'll cover advance parts ✌️😇
Simple Snippets no problem!❤️ thank you for all you do. I’m writing a notebook with all your tutorials to help me review and teach myself c++ gonna do the same for Java!
Oh that's cool. Super happy to hear this from you Kevin. Means a lot to me 😇
Keep up the support ✌️
can u make a video on multiple try catch block little bit confusion in that
you are the best.......masum
I want to ask one thing that I also write exceptionhandling in dev c++ because it wasn't working turbo c++ but I write iostream without .h but my teacher doesn't understand and deduct my marks because I didn't wrote .h. How do I explain her that I am right
+Nidhi Dubey You show her/him your code on Dev C++ IDE and show that it works. If she/he doesnt agree then no one can help it here. See turbo C++ and Dev C++ are 2 different IDEs with different compilers thus that difference.
here's what I found as the basic difference : www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwikpqLT3vLWAhWCqo8KHbt5Au8QFggoMAE&url=https%3A%2F%2Fdiscuss.codechef.com%2Fquestions%2F48899%2Fdevc-help&usg=AOvVaw1p-aUSZiqQNlCLHoR2Ocrk
see if your code is working then your professor should give you the marks.
Instead of this I can also use if else so what the difference is
Truly osm bhayyaa... Tq
thanks bro you helped me alot
Glad I could help. Please do share the videos and our channel with your friends if you want to genuinely support me & our channel!✌😇
@@SimpleSnippets ok bro definately I will share
Excellent explanation thank you. Need3d a quick refresher
Thanks buddy, glad to hear this from you. Please do share it with your friends too. That's the biggest help & support 😊
Wow!! Thankuuuu so much 😍
how to solve the ambiguity of function overloading
sir can you make a video on threads in c++
what will do when return value is comming in c++
Sir did I get a vedio about multiple catch exception and catch all exception
Thanks for uploading this video it is very helpful ....
Most welcome 😁
Please do share it ✌️
Of course iam sharing this video to my class mates... they will understand it better rather than regular classes
Thank you so much for sharing 😊✌️
It's the biggest help and support for the channel and everyone 😊
Simple Snippets>buckys
well explained!
Thank you so much buddy🙏 Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
Nice work dude
Bro do a video on "exception classes"
thankyou for this video i have my exam today
Thank you so much Mansi. Glad to hear that this video helped you 😇
There are many videos on our channel. Do check them ✌️
And would request you to share the video with your friends too ✌️
And all the best for your exam 😇
@@SimpleSnippets the same question came in my exam with the same example as question🤩🤩
Wow amazing 😇✌️
Hope your exam was great buddy. ✌️
@@SimpleSnippets yes it was great
Superb 😇 so happy to hear this Mansi ✌️
Please do share the videos 😋
what is the role of int ex parameter in catch?
Awesome bro!!!
That's great to know Monish, please do Subscribe to our channel as we have a lot tech educational content which you'll surely like. Also please do share our channel and videos with your friends too, that's the biggest help and support you can provide buddy ✌
@@SimpleSnippets yeah I subscribed days ago
@@monishshetty5140 thats amazing to know. Welcome to the family 😊🤟
Why can't I just use switch case ?
But my result is different it will show any random value
Love your teaching method😍😇
I'm so glad! Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
How to handle multiple exception
Hey!! That's Nice. But you didn't tell about "Multiple Catche", "Re-throwing an Exception", Exception specifications.
Yes understood....thnk u :)
Most welcome 😊
sir iam unable to compile d prgrm ni turbo c++
can u plz suggest me what changes i can make 2 execute d sme prgm in turbo c++
plz ans me!
I think you'll just have to change that preprocessor line as - #include
and use void main () instead of int main ()
Also at the end of main function don't use the return 0 statement
+Simple Snippets
ok thank u ..i will try it
multi threading and data collection bhi bata do please
Please make a video on stack unwinding
Thank you so much ❤️
You’re welcome 😊
bro cant ı just use if statment?
just found your channel. it's amazing work. thanks for the help
More than perfect
Thats great to hear buddy, Please do subscribe and share our channel with your friends too! Thats the biggest help and support 😇
Amazing bro
Most welcome buddy 😇 I would request you to please share the video with your friends too ✌
Thank you so much for such a wonderful lecture.
Thank you so much buddy, Please do share this video with your friends too. Thats the biggest help and support 🙂
Definitely.
Thanks sir ☺️
Thank you so much buddy🙏 Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
well explained
❤️❤️❤️thank you !