CS240 Project 2: Typing Tutor

Due Date

October 7th, 2009, 9:30p.m.

Introduction

In this project, you will create a typing tutor program. This simple typing tutor program basically displays a sentence on the screen and then waits for the user to type what is displayed. When the user has finished typing, the program displays the number of errors made by the user.

Preparation

Download the list of practice text from the following link. Save the file to your working directory.

text.h

Take a look at the contents of the above file. There are three variables--TEXTCOUNT, TEXTLENGTH and text. The value of TEXTCOUNT gives the number of sentences in array text. The variable text is a pointer to an array of strings containing the sentences.

To use this file, include it in your .c file by putting #include "text.h" at the top of your .c file.

Project Detail

Write a program that displays sentences on the screen and prompts the user to enter the exact text displayed. Follow the steps below to complete this project.

Sample Output

lore 30 % ./p2.out
CS240 Project 2: Typing Tutor
-----------------------------
Instruction: Please type each sentence as displayed, or QUIT to exit.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa.

You typed 0 wrong characters (0.00 %).

Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna. Nunc viverra imperdiet enim.
Fusce posuere, magna sed pl

You typed 117 wrong characters (81.82 %).

Fusce est. Vivamus a tellus.
Fusce est. Vivamus

You typed 10 wrong characters (35.71 %).

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin pharetra nonummy pede.
Pellentesque habitant morbi tristique sens

You typed 81 wrong characters (66.39 %).

Mauris et orci. Aenean nec lorem.
Mauris et orci. Aenean nec lorem.

You typed 0 wrong characters (0.00 %).

In porttitor. Donec laoreet nonummy augue.
In porttitor. Donec laoreet nonummy augue..

You typed 1 wrong characters (2.38 %).

Suspendisse dui purus, scelerisque at, vulputate vitae, pretium mattis, nunc. Mauris eget neque at sem venenatis eleifend.
Suspendisse dui purus, scelerisque at, vulputate vitae, pretium mattis, nunc. Mauris eget neque at sem venenatis eleifend.

You typed 0 wrong characters (0.00 %).

...

Nunc lacus metus, posuere eget, lacinia eu, varius quis, libero. Aliquam nonummy adipiscing augue.
Nunc lacus metus, posuere eget, lacinia eu, varius quis, libero. Aliquam nonummy adipiscing augue.

You typed 0 wrong characters (0.00 %).

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa.

You typed 0 wrong characters (0.00 %).

Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna. Nunc viverra imperdiet enim.
QUIT

In total, you have typed 6598 wrong characters (94.68 %).
lore 31 %

Requirement

Turnin

When you are satisfied that your program works correctly (or you run out of time), please do the following.

  1. Create a directory named project2
  2. Copy all program files (*.c and *.h) and your Makefile to the directory created in step 1.
  3. Goto the parent directory of project2 and type the following command into the terminal:

    turnin -c cs240=XXXX -p project2 project2

    where XXXX represents your lab section number.

    The turnin section is as follows:

    Section Time TA
    0201 Thursday 15:30-17:20 Dan Zhang
    0301 Friday 09:30-11:20 Suli Xi
    0401 Friday 13:30-15:20 Youhan Fang
    0501 Thursday 09:30-11:20 J. C. Chin

    Make sure turnin reports that your project was submitted for grading. You can check the files you have submitted by running the following command:

    turnin -c cs240=XXXX -v -p project2
  4. Submit often to make sure that you did not try to submit after turnin has been turned off.

Grading

Your project will be graded against a set of test cases. Points are awarded by passing each test case.

Makefile 5
Welcome message and instruction are printed correctly. 2
The practice text is printed correctly. 3
Statistic is correctly printed after each sentence. 5
Statistic is correctly printed when program exit. 5
The first sentence is used again after all the sentences have been used. 10
10 Test cases 70 (7 for each)