C questions It is not asking for a full code but rather part

C++ questions. It is not asking for a full code but rather parts of it.

1. Create a structure that can be used to maintain inventory in a hardware store. It should contain a string for the items name (hammer, saw ect) the quantity (int) and the price (not as a string, as a double). Structure should be called Tools.

2. Show how to create an instance of the structure. Call it hammer.

3. Show how to access the price data member of the structure with the variable from 2

Solution

#include <iostream>
struct Tool //Sruture Definition
{
char ItemName[50];
int quantity;
double price;
};
int main()
{
Tool Hammer; //instance of structure
   double prc = 200.50;
   Hammer.price =prc; //accessing data member
   cout<<\"Hammer Price is\"<<Hammer.price;
   return 0;
   }
  

C++ questions. It is not asking for a full code but rather parts of it. 1. Create a structure that can be used to maintain inventory in a hardware store. It sho

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site