Nous
Coder
Hey guys,
A newbie here! 👋
I have this problem, so I have to use c++ to add data to a txt file (item name, price) and after adding that I want to be able to save that txt file, be able to list all the data in the txt file and also search that txt file.
I am currently in the midst of programming this for one of my CS classes. Likewise, I have managed to create a void function to connect to the txt file and also a void function to add data to the txt file, somehow the data does not get stored. Every time I add a new item, it replaces the data in the txt file. I want to be able to create all add, list and search as void functions.
I am quite new to C++ and I have been trying my best to learn about fstream, ifstream and ofstream. If anyone can guide me in this I would really appreciate it.
Thanks!
A newbie here! 👋
I have this problem, so I have to use c++ to add data to a txt file (item name, price) and after adding that I want to be able to save that txt file, be able to list all the data in the txt file and also search that txt file.
I am currently in the midst of programming this for one of my CS classes. Likewise, I have managed to create a void function to connect to the txt file and also a void function to add data to the txt file, somehow the data does not get stored. Every time I add a new item, it replaces the data in the txt file. I want to be able to create all add, list and search as void functions.
I am quite new to C++ and I have been trying my best to learn about fstream, ifstream and ofstream. If anyone can guide me in this I would really appreciate it.
Thanks!