CesarZ
Well-Known Member
- Joined
- Sep 20, 2012
- Messages
- 269
- Solutions
- 4
- Reaction score
- 63
How can i apply this error handling code in adding() function?I just want to see how you guys would set it up.
if you have another function you want to add as an example instead of adding() add it. it's just for learning purposes.
i want to see different ways from people.
Thanks.
if you have another function you want to add as an example instead of adding() add it. it's just for learning purposes.
i want to see different ways from people.
Thanks.
C++:
enum class Error {
SUCCESS,
FAIL,
};
void errorMessages(Error type) {
switch (type) {
case Error::SUCCESS: std::cout << "Success" << std::endl;
break;
case Error::FAIL:std::cout << "Fail" << std::endl;
break;
default:
std::cout << "Error in the code" << std::endl;
}
}
//fucntion to test it\/
int adding(int x, int y){
sum = x + y;
return sum;
}
int main()
{
adding(4,4);
return 0;
}