+ 1

How do i make cin to recognize only numbers?

18th Apr 2023, 7:14 PM
Jasubu Ishaya
2 Réponses
+ 1
With this method: int num; cin >> num; num gets the user's number. If the input is not a number (like string), num value is 0
18th Apr 2023, 8:07 PM
Ugulberto Sánchez
Ugulberto Sánchez - avatar