First, you cannot expect others to code for you. You should try to do what you want yourself, and if you have any specific technical problem, please post them here.
You'll need to learn the following things:
First learn about handling file I/O in C++ :
http://www.cplusplus.com/doc/tutorial/files/[
^]
Your
database.txt
file may probably have a scheme like XML or JSON. To parse JSON or XML they are plenty of open source C++ libraries (To find them google will help you).