Answer the question
In order to leave comments, you need to log in
How to validate input data in c++?
I have code that takes three int outputs from keyboard input. I need to display an error if the user entered a non-numeric value. The error needs to be specified. How is it possible to implement it?
#include <iostream>
using namespace std;
int main()
{
double a_number, b_number, result;
int c_number;
cout <<"Введите вещественное число а в диапазоне от -1000.0 до 1000.0 включительно: \n";
cin >> a_number;
cout <<"Введите вещественное число b в диапазоне от -1000.0 до 1000.0 включительно: \n";
cin >> b_number;
cout <<"Введите вещественное число c в диапазоне от -1000.0 до 1000.0 включительно: \n";
cin >> c_number;
{
result = sqrt(a_number-b_number)/ (c_number%2);
cout << result;
}
return 0;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question