structure

So I am trying to write a program that has 3 subcategories under the category section.
the subcategories are donuts, drinks and chips
struct Inv
{
double sku;
char category[SIZE];
int qty;
double sale;
int date;
};

cout<<"Enter the sku: \n";
cin>>sku;
cout<<"Category: \n"
cin>>category;

I have to make the subsections here so the user can choose the category. But I am confused on how to do that.
Last edited on
First I would like to say

 
char category[size] 


Can be quite unstable if you don't use a pointer. However, if I understand your question right why don't you just include the category choices in the cout statement such as

1
2
3
4
5
 
cout << "please choose  a category donuts, drinks, and chips \n"; 
cin >> category; 

// then do whatever you were going to do with this program 


or am I misunderstanding the question?
Last edited on
In the later of the program, I have to display the sale price for each category.
I think I get where your going with this but, still kinda fuzzy on the details. So you want kinda this deal? It's just question is kinda ambiguous and hard to tell what your actually after. I see if my algorithm is the same as yours.

-chose a category
-display price of category
- get quantity of category
- display total price of category
- Not really sure what the sku and date variables are for
- then check if the individual wants a different category
Topic archived. No new replies allowed.