Well, pretty much means you have misplaced and/or misnamed your file. You have to place it with your main.cpp and where your .vcxproj is, if you're just gonna use "inventory.txt".
Your code has a couple of syntax error (line 35, line 39). However, to answer your question. I created a file "inventory.txt" and placed it in the same place as the main.cpp and it reads the file. Could you tell us what the program is supposed to do?