Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3.  
  4. void TryRead(int *x) {
  5.     if (!(std::cin >> *x)) {
  6.         std::cout << "Fail on reading" << std::endl;
  7.         exit(0);
  8.     }
  9. }
  10.  
  11. int main() {
  12.     int a;
  13.     TryRead(&a);
  14.  
  15.     std::cout << abs(a) << std::endl;
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement