(Solved):Assume that you have the following definition of a struct: struct partsType string partName; int partNum; double price; int quantitiesInStock: ; Declare an array, inventory, of 100 components… View Answer…

 

Question

Assume that you have the following definition of a struct:

struct partsType

{

    string partName;

    int partNum;

    double price;

    int quantitiesInStock:

};

Declare an array, inventory, of 100 components of type partsType.

a. Write a C++ code to initialize each component of inventory as follows: partName to null string, partNum to -1, price to 0.0, and quantitiesInStock to 0.

b. Write a C++ code that uses a loop to output the data

Scroll to top