I am writing a string of characters using character arrays only. For instance, it asks the user for how many records you want. Say 3, it can vary. Then you type three records. These three records will be written to a text file... Please look at the end of this post for ref.
If you don't want to display the fruits until all have been entered, you're going to have to store them in an array.
Can you use std::string ?
std::string would make this a lot cleaner. Fruits would become simply an array (or vector) of strings. Copy and clear functions are built in to std::string. You wouldn't have to code those yourself.
Actually, I would suggest making Fruit its own class. The Fruit class would then be responsible for intiializing each instance of itself. A setFruitName function could copy the user input into the instance of Fruit. Line 67 becomes an array of Fruits instances. A getFruitName function could retrieve a pointer to the Fruit name.
I mean, the data will be written to a txt file. Once we write, then we could use a read method to display them.... I just do not know how. Please help.