Horje
C++ try catch Code Example
C++ try catch
try {
   //do something
} catch (const std::exception& e) {
     std::cout << e.what(); // information from error printed
}
throw exception c++
#include <stdexcept>
#include <limits>
#include <iostream>

using namespace std;

void MyFunc(int c)
{
    if (c > numeric_limits< char> ::max())
        throw invalid_argument("MyFunc argument too large.");
    //...
}




8

Related
c++ vector print Code Example c++ vector print Code Example
user input c++ Code Example user input c++ Code Example
c++ throw exception Code Example c++ throw exception Code Example
stl for sorting IN C++ Code Example stl for sorting IN C++ Code Example
cpp print vector Code Example cpp print vector Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8