This is a console-based typing speed test application written in C. It measures your typing speed in characters per minute (CPM) and words per minute (WPM) and calculates your accuracy.
- Generates a random sequence of words for the typing test
- Measures typing speed in characters per minute (CPM) and words per minute (WPM)
- Calculates typing accuracy
- Highlights correct, incorrect, and remaining characters in different colors
- Adjustable number of words for the test
- Centered text display for better readability
- Handles user input, including backspaces and spaces
typing_test/
├── CMakeLists.txt
├── src/
│ ├── main.c
│ ├── terminal.c
│ ├── terminal.h
│ ├── words.c
│ ├── words.h
│ ├── common.h
│ ├── wordlist.c
│ └── wordlist.h
- Clone the repository:
git clone https://github.com/Slipum/typeTest-on-c
- Navigate to the project directory:
cd typeTest-on-c
- Create a
build
directory and navigate to it:
mkdir build
cd build
- Compile the program using CMake:
cmake ..
make
- Run the compiled program:
./typing_test
- Enter the number of words you want to type.
- Start typing the displayed words. Make sure to include spaces between words.
- The test ends when you press the Enter key.
- View your typing statistics, including time taken, CPM, WPM, and accuracy.
clearLine()
: Clears the current line in the console.clearScreen()
: Clears the entire console screen.disableRawMode()
: Restores the terminal to its original state.enableRawMode()
: Sets the terminal to raw mode to capture input directly.moveCursorTo(int row, int col)
: Moves the cursor to a specific position on the screen.printWordsWithColor(const char **words, int numWords, const char *input, int inputLength)
: Prints the words for the typing test with colors indicating correct, incorrect, and remaining characters.shuffleWords(const char **words, int numWords, const char **selectedWords)
: Randomly selects words for the typing test.getNumberOfWords()
: Prompts the user to enter the number of words for the test.runTypingTest(int numWords)
: Runs the typing test and calculates the results.
- Enable Raw Mode: The terminal is set to raw mode to handle user input directly.
- Word Selection: A random selection of words is generated based on the user's input for the number of words.
- Typing Test: The selected words are displayed, and the user types them. Correct and incorrect characters are highlighted.
- Results Calculation: Once the user completes the test by pressing Enter, the time taken, CPM, WPM, and accuracy are calculated and displayed.
- Repeat or Exit: The user can choose to repeat the test, change the number of words, or exit the program.
Enter the number of words you want to type: 10
test application random words calculate performance
The user starts typing the displayed words, and the program highlights the correct, incorrect, and remaining characters in real-time.
Contributions are welcome! Please feel free to submit a Pull Request or open an issue on GitHub.
This project is licensed under the MIT License. See the LICENSE file for details.