Even after your edit, your code still is wrong/incomplete.
Why the struct is called
Store, but the type of the parameter that goes into
showProducts() is
STodd, which was
never declared anywhere, as far as I can tell? Similarly, where does the variable
Choice come from? I see it being passed into
showProducts(), but it was never declared or initialized before.
1 2 3 4 5
|
for(int a = 0; a < 5; a++)
{
cin >> choice;
choice = s.color[a];
}
| |
This loop reads an integer from the
stdin (e.g. keyboard) and stores it into
choice,
five times. But, after each input, it immediately overrides
choice with the
color at the index that equals the current loop counter
a.
So,
effectively (after all 5 loops), this loop ends up doing
nothing, except for:
choice = s.color[4]
Is that really what you want?