Storage and retrieval of ints in a vector and string

Hey everybody! I'm having an issue with retrieving and re-storing an int as a way to keep track of sales for a school assignment. I might build off of this later and make it more efficient, but right now, I'm running into some issues and it may be out of reach for the goals of our assignment. But gotta learn some time.

Here's what I have after playing around with it so I realize that there is useless junk within the code.

cout << CookieNames[0] << " = " << a[0];
Sales();

cout << "Boxes sold: ";
cin >> sales;

prevsales = a[0];

prevsales += sales;

cout << "New records for " << CookieNames[0] << " are " << a[0] << ".\n\n";

CookieNames = Eight types of cookies sold
a[0] = where I would like to store value

I have these two parallel with another (possibly multi-demensional later)

I am hoping to take (int) sales and add it to a[0] then store it in a[0] again and prevsales was thrown in to try to accomplish that. Also, as of right now, there is nothing that shows up for a[0].

Please let me know if any of this isn't clear or if more background info is required.

Thanks for your time!
Here is how to store a value in a[0]:

a[0] = value;

I don't see you doing that in your code.
Ok thanks! And is value the number or an int (int value)? If it's a number, how do I add the previous number to the new sales to store the total sold in the string? The same way? Or is there a way to pull it from int value and store it?
Here is how to store a number.
a[0] = 3;

Here is how to store the value of an already existing int.
a[0] = someInt;


If this is news to you, you need to go back to the very start.
Ok well I am at the very start. So it's nothing for you to try and degrade me about.

Honestly, there's got to be another way to do it. Because that would make it so I'd have to create 80 variables bare minimum via your way as shown (8 cookies x 10 people and the people are in a dynamic vector). I already did have each element = 0. But the problem for me lied in re-storing it, it didn't like it.

Sorry to have troubled you. Sorry that my book doesn't cover easier ways to store and add to elements of a vetor or string. . . Just forget about it and keep in mind that if you want to help people learn, don't be so rude even with the simplest of problems.

Thanks again for your time.
Topic archived. No new replies allowed.