Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
ExceptionHandling1
//g++ 7.4.0 ////////////////////////////////////////////////////////////////////////////////ExceptionHandling1:C++ exception handling //this code is created by Rezaul Hoque on June 07,2022; //contact:jewelmrh@yahoo.com;Dhaka,Bangladesh;https://rezaulhoque.wordpress.com,https://hoquestake.blogspot.com //note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; ////////////////////////////////////////////////////////////////////////////// #include <iostream> class PosInt { int t; public: PosInt(){} PosInt(int s){ t=s; } ~PosInt(){} int getInt(){return t;} }; int main() { PosInt a (-1); try{ if(a.getInt()<0) throw a.getInt(); else std::cout<<a.getInt(); } catch(...){ std::cout<<"It's a negative number."; } return 0; }
run
|
edit
|
history
|
help
0
32535
Beadandó
series
C++ Solar eclipse program(Shoushi integrated) 1644 - 1785 from Ideone( Date: August 14, 2014 )
ThreeVariableRegression
Abejas WA
New wall
Expected types
Simulare 2022
LRU cache