C++ struct 2 dimensional array

i faced a problem when i want to let user store their name, age, favourite word and favourite number, and i would like to store them to txt, then when others need to enter their information, it will open the txt to compare to reduce duplication of info in a txt file. how can i do that ?
Ask for info, read data file, compare read data to that entered, repeat. Process as required.

If you have a coding issue, then post your existing code so that we can see what you're done.
There is no way you can store a struct in a plain text file. At least, not that I know of. You'd be better off using a binary file for that (although then you have to use C-strings...ugh).

If you don't know how to use binary files, then you should study up on them– they are very, very useful for inventories and lists and things like that.
Something like a CSV file could be used with >> << operators overloaded to read from/write to the file in the required format. Read all the data into a suitable container, update as needed then write the data back to the file.
You haven't explained why you think it needs to be a two dimensional array per your title?
Topic archived. No new replies allowed.