I have to use a variable of type double to store and manipulate a value for an amount of years. This means I have to ensure that the data input by the user is an integer. The program will accept a non-integer value, but I want it to continue reprompting the user when a non-integer is entered. I thought I had this solved, but it does not work for some reason. Here is the code:
do
{
userinputfunction(x,y,z,etc...)
} while((loanYears <= 1) && (loanYears >= 100) && ((floor(loanYears)) != loanYears));
However, the do ... while loop does not work as planned! Everything but the last part works. [i.e. - ((floor(loanYears)) != loanYears))] The last part is supposed to validate the users input as an integer.