+ 1

In c++ code, suppose user submit char instead of integers then how can i display a error msg that's you have wrongly submit?

Suppose there is code of c++ for finding the largest number and user have to submit number and if user submit character also then how can i display warning msg that's you have submitted char, take only integers.. If possible please help me

29th May 2021, 12:42 PM
KAUSHAL KUMAR
KAUSHAL KUMAR - avatar
2 Réponses
+ 1
try { cin >> number; } catch (Exception e) { cout << "Invalid input" << endl; }
29th May 2021, 4:01 PM
Eashan Morajkar
Eashan Morajkar - avatar