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 integer or floating point value.
In option 3, the user will input the ID, Quantity Received, and the Unit Cost as a single string.
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.

This is what I added to my main so far, can anyone help me build off this and see if this is correct so far. Need anything else just ask, but I need help ASAP, anything is appreciated.

/*cin.getline(inputString. 100. '\n');
      
   idString = strtok(inputString. ",");
   if (verifyValue(idString))
    id = atoi(idString);
   else
   {
    cout<< "ID has an invalid value";
    id = numberOfItems + 1;
   }
   inventoryItem[numberOfItems].setID(id);
     typeString = strtok(NULL. ",")
   type = atoi(typeString);
   inventoryItem[numberOfItems]. setType(type);
   descString = strtok(NULL. ",");
   description = descString;
   inventoryItem[numberOfItems]. setDescription(description);
   quantityString = strtok(NULL. ",");
   quantity = atoi(quantityString);
   inventoryItem[numberOfItems]. setQuantity(quantity);*/

Please don't make duplicate threads on the same topic, it just wastes people's time.

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 integer or floating point value.
In option 3, the user will input the ID, Quantity Received, and the Unit Cost as a single string.
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.

This is what I added to my main so far, can anyone help me build off this and see if this is correct so far. Need anything else just ask, but I need help ASAP, anything is appreciated.

/*cin.getline(inputString. 100. '\n');
 
   idString = strtok(inputString. ",");
   if (verifyValue(idString))
    id = atoi(idString);
   else
   {
    cout<< "ID has an invalid value";
    id = numberOfItems + 1;
   }
   inventoryItem[numberOfItems].setID(id);
     typeString = strtok(NULL. ",")
   type = atoi(typeString);
   inventoryItem[numberOfItems]. setType(type);
   descString = strtok(NULL. ",");
   description = descString;
   inventoryItem[numberOfItems]. setDescription(description);
   quantityString = strtok(NULL. ",");
   quantity = atoi(quantityString);
   inventoryItem[numberOfItems]. setQuantity(quantity);*/

I did this post, b/c i was giving more information and I want a better title to show I needed help.
Thanks though

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.