cs-academia

A work in progress; documenting my academia => There are NO DEMOS yet, just the code

View on GitHub

Project 2: Type Keys

Background Info

Once upon a time there were keyboards attached directly to printers, and they were called typewriters. They didn’t require electricity to work, and they were used by people everywhere for about 130 years. They looked like this.

Project Description

In this program, we will do a very basic and determinable exploration of the two layouts, comparing and contrasting them. We will do via reading a text file (to act as the document “being typed”), and utilizing provided measurements of keys’ distances from the home row, and this program assumes user is “touch-typing” using all 10 fingers (8 on home row). We will be turning the file into words one would type on a typing test, so rules on how to strip the words into usable form are described below.

QWERTY Keyboard DVORAK Keyboard

Actual Problem to Solve

Rules that we are provided with to format the words are as follows:

Output (Not Accurate, Just for Reference)

Author: Anthony Makis
Program: #2, Type Keys

First two lines of the input file are:
TWENTY THOUSAND LEAGUES UNDER THE SEA
by JULES VERNE

               Total words:    4326
Total non-blank characters:   32098

                                Qwerty    Dvorak
% All Characters on home row:      3         40
     % All Words on home row:     25         43  
   % Words typed on one hand:     17         13
   Distance travelled(miles):  1.583      0.796

Project Structure

This is to be developed in one stage, procedurally. There are 2 files being provided to us:

Restrictions for this Project

We were only *loosely* prompted to use fgets() for this task, and we were also allowed to try to use strtok(); other than this there weren’t any extra requirements :)

We were also told that: “For reference sake, typing at 60 wpm for 7 hours a day it would take you over 4 days to type the book”. This will be a useful benchmark in retrospect of running the solution.

Any further, atomic requirements are described in the different Stages!

My Solution in Action

Project 2 in Action!

I have a Makefile for quicker compilation, and then we run the executable (v1). Makefile is written to support general compilation of most .c files, so I will reuse it throughout projects, making updates to it ocassionally.

Results Screenshot

Project 2 Results!