Hi guys,
Below is my validation function, what it should do is check the length of num1 which is a string( bad name i know!) and also convert num1 to be a floating point number, then it should check to see if the length is less than or equal to 6, and in the range of 0 -1000,
What i also need to do in this function is to check that no letters have been entered,
Code:float validation1() // validation1 function { length1 = strlen(num1); // Finds out length of string convertnum1 = atof(num1); // converts string to float if (length1 <= 6 && convertnum1 >= 0 && convertnum1 <= 1000) // check length & range { return convertnum1; } else { calc(); // calls calculation function } return 0; } // end of validation function
Does anybody know how this could be achieved?
i have heard of a function called isdigit(), would this be used?
Thanks alot guys
Boontune