Sc3ric

integer check

Feb 13th, 2023
717
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.22 KB | None | 0 0
  1. int getData(string text) {
  2.     char* eptr;
  3.     int out;
  4.     string in;
  5.     do {
  6.         cout << text;
  7.         cin >> in;
  8.  
  9.         out = strtol(in.c_str(), &eptr, 10);
  10.     } while (*eptr != '\0');
  11.     return out;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment