Advertisement
MaksNew

Untitled

Feb 13th, 2021
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. int getMatrixItem()
  2. {
  3. int ret;
  4. bool isIncorrect;
  5. string inputLine;
  6. do
  7. {
  8. cout << "Введите значение элемента матрицы";
  9. getline(cin, inputLine);
  10. isIncorrect = false;
  11. try
  12. {
  13. ret = stoi(inputLine);
  14. }
  15. catch (...)
  16. {
  17. isIncorrect = true;
  18. cout << "Значение матрицы должно быть числом\n";
  19. }
  20. } while (isIncorrect);
  21. return ret;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement