Database Program

closed account (SEbXoG1T)
i am trying to make a database (of Spanish questions), but i have no clue on how to do this. Once i have a database, i will need help making a program that randomly selects questions from it. Any help would be well appreciated
closed account (3hM2Nwbp)
You have a few options on the data source:

1) Use SQL
a) You'll need a flavor of SQL installed
b) You'll need to write a connector class (or use the bare connector API)
c) You'll need to query the database for your question strings

2) Use a file
a) You'll need to come up with a format
b) You'll need to parse the file into tokens
c) You'll need to store the tokens for your question strings

I assume that you're doing this project in order to better learn C++. If that's the case, then try both ways and see which one you prefer.
Last edited on
closed account (SEbXoG1T)
how would i go about doing the second one?
closed account (3hM2Nwbp)
Again, you have multiple options.

1) Use a structured data format like XML

<questions>
    <question>SpanishQuestionGoesHere</question>
    <question>AnotherQuestion</question>
</questions>


2) Use a simple per-line based format

SpanishQuestionGoesHere
AnotherQuestion


For option 1, there are many XML parsers available.
For option 2, you'll have to load the file and read each line.

There are an infinite number of ways to skin cats in C++. That sounded darker than I thought it would.
Last edited on
closed account (SEbXoG1T)
it would have to be encrypted
closed account (3hM2Nwbp)
Step 1 would be to get it working without encryption.
U could use dat files but im not sure is it as easy with c++. I tried with Qt and was mega easy. dat files got alotta non-human-readable text.
I would go with option 1 and sqlite. If you don't know sql, you would be able to pick up enough to store/retrieve your questions in a few hours. The API of sqlite is very simple to use. and it doesn't need a server, you can just compile it into your executable.
Topic archived. No new replies allowed.