Hey I'm trying to have my code throw up an error if anything other than a numerical value is input by the user.

This is what I have done so far but when I run the program and input a character instead of a number it just skips through the rest of the inputs and outputs calculations without actually throwing up any error message.

```
#include "classes.h"
#include <iostream>
#include <math.h>
using namespace std;
//class constructor
thevenin::thevenin()
{
    Resistance_1 = 1;
    Resistance_2 = 1;
    Resistance_3 = 1;
    Voltage_1 = 1;
    Voltage_2 = 1;

}
//empty class destructor
thevenin::~thevenin()
{

}
//output script for One loop problems
void thevenin::One_loop_thev(float tr1o, float tv1v)
{
    //inputs

    if (cin.fail()) //checking whether failbit or badbit is set
    {
        cout<<"error";
        cin.clear(); //sets a new value for the stream's internal error state flags.
        cin.ignore(numeric_limits<streamsize>::max(),'\n'); //ignores rest of the input ..
    }
    else;

            cout<<"Please enter the value of R1"<<endl;
            cin>>Resistance_1;
            cout<<"Please enter the value of R2"<<endl;
            cin>>Resistance_2;
            cout<<"Please enter the value of R3"<<endl;
            cin>>Resistance_3;
            cout<<"Please enter the value of V1"<<endl;
            cin>>Voltage_1;

            //calculations
            tv1v = (Voltage_1 * Resistance_3)/ (Resistance_1 + Resistance_3);
            tr1o = Resistance_2 + ((Resistance_1*Resistance_3)/(Resistance_1+Resistance_3));

            cout<<"The Thevenin equivalent resistance is: "<<tr1o<<"ohms"<<endl;
            cout<<"The Thevenin equivalent voltage is: "<<tv1v<<"volts"<<endl;

```

I was just wondering how I should adjust the `if(cin.fail())` statement to work with my code.