SQLite is a library that implements a databae engine. Its simple enough to use with c and c++, doesnt require network connections, files can be created locally and its a great solution for saving persistent information from your applications.
Download the source code
make depend run
Change the SQL macro in src/main.cpp for different queries.