Question: Hi, I'm writing this program that after validating the user input to be an integer, it validate it to more than zero and be less

Hi, I'm writing this program that after validating the user input to be an integer, it validate it to more than zero and be less or equal to 40. My code does validate entry for being an integer but after that i'm stuck. i want to check if the entry is 0

#include  #include  #include  using namespace std; int validateHoursWorked(string str1, int& userNumber); int main() { string str1; int userNumber; cout<<"Enter the requested information for each employee."< 0, try again "; getline(cin, str1); entryLenghth=str1.length(); counter=0; } else { counter++; } } counter = 0; //convert the string into numeric value for //numeric operations while (counter < entryLenghth) { someChar = str1[counter]; if(isdigit(someChar)) { usernumber = usernumber*10 + (someChar - '0'); } counter++; } return userNumber; } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!