I need help verifing. If you need more information let me know, but I am a beginner. Just need help with the verifyValue.cpp
what kind of code or functions would you suggest.
Thanks

In options 1 and 2, the user will input the ID, Type, Description, Quantity on Hand, and Unit Cost as one string with the values separated by commas. Use the function strtok to parse the input into separate values. For the numeric values, call the function verifyValue to verify that the input string is a numeric value. Then call the functions atoi and atof to convert the input into an
One new Function

Create a new function to verify the numeric input values. This function will be in a separate source file.
verifyValue.cpp

This function will determine if a string contains a valid numeric value. It will return true or false.

Welcome to Daniweb!

I'm having trouble telling where option 1 and 2 separate and whether there is a third option. Your description however sounds pretty good. Some folks here would prefer to see you use something like sprintf() or a stringstream to convert strings to numerical values, but atox() family of functions will work most of the time, too.

If you don't like using strtok() then you could probably do something similar with getline() using ',' as the delimiter instead of '\n'. Without seeing code and knowing what you are familiar with it's difficult to say which would be best.

I need help verifing. ......
Create a new function to verify the numeric input values. This function will be in a separate source file.
verifyValue.cpp

This function will determine if a string contains a valid numeric value. It will return true or false.

bool verify_value( const char* cstr )
{
    if(  ( *csr ==  '-'  ) || ( *cstr == '+' ) ) ++cstr ; // one leading + - is ok
    while( cstr != 0 ) 
        if( !isdigit(*cstr++) ) return false ;
    return true ;
}

note: checks only for decimal digits, see isxdigit if hex is to be supported.
asssumes there are no leadin/trailing spaces.

This article has been dead for over six months. Start a new discussion instead.