back to the previous value?

I have a question. do we have any function in C++ to get back the previous value while running the program?
For Example:
First Name: Anthony
Last Name: john
Gender:
the pointer is at the Gender value right now soo is there any way to get back up at the Last Name value to change the name in C++? I just start learning C++, thank everybody.