Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Assertion Divide by Zero Example
#include <assert.h> #include <iostream> using namespace std; int division(int a, int b) { if (b==0) { cerr << "Error at line " << __LINE__ << " in file " << __FILE__ << endl; } assert(b!=0); return (a/b); } int main () { int x = 11; int y = 0; int z; z = division(x, y); cout << "Answer is " << z << endl; return 0; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
UTF-8 in C++11
C++ Standard Template Library
Diamond example
lref assignment
Result of not joining thread in main()
Class operator overloading the subscript and boundary check for array
Program to Time Difference
Recursive Function Calling Example with Stack Addresses
Pure virtual function called!
unordered graphs search
stackse - search stackoverflow differently
Please log in to post a comment.