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 ?
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.