Please, go to tutorial section of this site and go again through lessons. You miss very basics, and you can't do well in harder things if you miss basics.
For example, this function:
1 2 3 4
|
int itemCount(int countOfItems) // replace itemQuanity
{
setItemQuantity(countOfItems);
}
|
And this function
1 2 3 4
|
void setItemQuantity(int itemQuanityNow)
{
this->itemQuantity = itemQuanityNow;
}
|
What is the purpose of creating public function that will call another public function?
In any place of your code, when you call
|
someInventory.itemCount(someInteger);
|
You can use
|
someInventory.setItemQuantity(someInteger);
|
The second one creates clear code, the first one makes many unneccesary operations (question for you: how many times will program call copy constructor of integer?).
Also, third thing about this function: it should return int. However, there is no return statement. Therefore, this function should either be of void type, or return something( I believe you wanted it to be of void type).
These three things show that you don't understand functions, which is required for you to advance.
Seriously, if you don't know why something doesn't work - first try to describe, step by step, what program is doing. Think like you had to describe it to someone who doesn't understand much of C++ .
You will see how many things your code has that aren't needed, and are making it less and less readable(check KISS in wikipedia).
For example, If I were you, I would start describing your code like this:
"First, I'm including many headers:
<cstdlib>, because I want to use X function(s).
<iostream> to use cin and cout.
<time.h> because I really like to include things I don't need.
Later, I declare inventory Class.
It has two private members:
and Integer called itemQuantity, which I immediately set to zero because I have no idea about declaring members of a class. It's purpose is to [...], and
string dateCounted, which I also set to be empty, because yet again, I have no idea what I'm doing. I think I should have paid attention to C++ lessons."
I just started describing your code, and found few things that could be corrected. By the time you reach main function, you will have whole bunch of things to fix there, not even talking about main function( why check for every possibility of "quit"?? What if user had to write some spell, like "Asamadarathurkya!"(random word). Would you check every possibility again? If you include something, try to use it at least! Check
toupper function from <cctype>!).
Fixing your code by yourself is really important at the beginning of your C++ journey.
You not only learn how to find and fix bugs, but you also make sure you know what you are doing, you can follow flow of program and you learn - and that is your priority now.
Before asking questions and saying your code isn't working, read tutorials again and try to fix your code by yourself. Find out WHY it isn't working(this code is actually small, so should be simple to debug), and if you don't know how to fix it - after trying - go on and ask, with explanation of error. If you follow my advice, you will fix 90%(at least!) of bugs by yourself.
Good luck!
PS. Oh, and one more advice: when you are learning, never copy code. If you are copying, you aren't learning.