Persistent data/settings in C++ application -


For the first time, I am writing quite a complex application, which will remember the user's name, gender, age, etc. Here I need to:

  • The application starts, and checks to see if the information (name, age, etc.) has been saved or not.
    • If not, the application gets this information and saves it.

      When the user restarts the program, the program should see that the information is saved, and this information is in the form of C ++ variables Saves in

      If you do not know what I want I can give more information. I've never done this before, and after searching the Internet for a long time, I've only been more confused, so I'm scared that I'm holding some strong hand, sorry should do.

      Thank you,

      - Chris.

      It seems that you are doing new C ++, so I have to save information to a file I will advise (This is the place where my course started, not with the database)

      Something like this should be done:

        #include & lt; Iostream & gt; # Include & lt; Fstream & gt; #include & lt; String & gt; Int main () {ifstream input ("your_saved_file.txt"); String name = "", age = "", etc. = ""; Input & gt; & Gt; Name & gt; & Gt; Age & gt; & Gt; e.t.c; If (name == "" || age == "" || etc == "") {input.clear (); Input.close (); Offstream output ("your_saved_file.txt"); Cout & lt; & Lt; "enter name: "; Cin & gt; & Gt; Name; Cout & lt; & Lt; "Enter age:"; Cin & gt; & Gt; Ages; Cout & lt; & Lt; "Enter etc.:"; Cin & gt; & Gt; e.t.c; Output & lt; & Lt; Name & lt; & Lt; Andal & lt; & Lt; Age & lt; & Lt; Andal & lt; & Lt; Etc. & lt; & Lt; Endl; Output.close (); Output.clear (); } And {input.clear (); Input.close (); Cout & lt; & Lt; "Name:" & lt; & Lt; Name & lt; & Lt; "Age:" & lt; & Lt; Age & lt; & Lt; "Etc.:" & lt; & Lt; e.t.c; } Return 0; }   

      Hope the kind of thing you are looking for,

      Reagan

Comments