i know how to make the loop, what I don't know is how to make it add a unique value to the structure on each pass. Forgive me if the code isn't exactly right, i'm typing this off the cuff so there might be some small syntax problems.
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
struct example
{
std::string var1
int var2
};
cout << "do you want one?/n"
cin >> want
std::string color
int amt
for (want, want=yes, want)
{
cout << "what color do you want?/n"
cin >> color
cout << "how many do you want?/n"
cin >> amt
cout << "do you want any more?/n"
cin >> want
}
|
this is why i get hung up. I then want the loop to output something like this
assuming the user said they wanted red, and then wanted 3
example red = {"red", 3};
so the variable red.var1 = "red" and red.var2 = 3
then on the next pass they want orange, and 4
so it would create orange.var1 = "orange" and orange.var2 = 4
they don't have to be named red.var1 and orange.var1, so long as the first portion is unique on each pass of the loop could come out as choice1.var1, choice2.var1, etc.