This Command Line Interface (CLI) application allows users to manage a database of questions and their corresponding answers. It offers functionalities to add questions with answers and to query answers for a specific question. If a question is not found, it responds humorously with a reference to "The Hitchhiker's Guide to the Galaxy".
-
Add Questions: Input a question followed by one or multiple space-separated answers, a separator between a question and answers is a question mark
?, every answer resides inside of doublequotes"(or every word separated by a space is treated as a separate answer otherwise):<question>? "<answer1>" "<answer2>" "<answerX>" -
Query Questions: Ask a specific question to retrieve all associated answers. A question should end with question mark
- A question is a string with max 255 chars
- An answer is a string with max 255 chars
- Every question needs to have at least one answer but can have unlimited answers
Before you build and run this application, make sure you have:
- CMake (version 3.5 or higher)
- A C++ compiler supporting C++17 (e.g., GCC, Clang)
- Google Test installed for unit testing
To build the application, execute the following commands:
# Clone the repository
git clone https://github.com/vmlinuz/questions_answers.git
cd questions_answers
# Create a build directory
mkdir build && cd build
# Configure the project with CMake
cmake ..
# Build the application
makeThis will generate the questions_answers executable.
To run the application after building, use:
./questions_answersFollow the on-screen prompts to either add questions or query the database.
To run unit tests set up with Google Test:
# Assuming you are still in the build directory after compiling
ctestThis command will execute all configured tests and report the results.
Contributions are welcome. Please ensure that any modifications adhere to coding standards and include corresponding tests where applicable.
Apache License 2.0