Typing Tutor
Typing Tutor
Dhananjay
KENDRIYA VIDYALAYA
MOSCOW
CERTIFICATE
This is to certify that Dhananjay
Sharma (Exam Roll Number) of class
XII has completed his project titled
Typing Tutor under the guidance
of Er. Dharmendra Thakur & this
project may be considered as the
part of the practical exam of AISSCE
conducted by CBSE for the academic
session 2014-15.
Teacher I/C
Er.
Dharmendra Thakur
ACKNOWLEDGEMEN
T
It would be my utmost pleasure to
express my sincere thanks to My
Computer
Science
Teacher
Er.
Dharmendra Thakur in providing a
helping hand in this project. His
unflagging patience, creativity and
immense knowledge that she shared
with
me
have
proved
highly
beneficial to me and have made my
Project File both possible and
successful.
Dhananjay Sharma
XII
INDEX
Serial
Numb
er
Topic
Introduction
Source Code
Output
Bibliography
INTRODUCTION
Typing is the basic command to run a
computer and your typing speed plays vital
role while working in computer to save time.
Here I have presented a Typing Tutor Project
in C++ to measure users typing speed and
to enhance their typing speed. This is a
simple console application written in C++
programming language, and compiled using
GNU GCC compiler.
#include<iostream.h>
#include<windows.h>
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<fstream>
#include<string.h>
#include<windows.h>
#include<fstream.h>
#include<ctime.h>
Class Used
WORDS
void main()
void checking()
void display(double dif)
SOURCE CODE
#include<iostream.h>
#include<windows.h>
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<fstream>
#include<string.h>
#include<windows.h>
#include<fstream.h>
#include<ctime.h>
void checking();
void display(double);
enum check{correct,incorrect};
class words
{
public:
char word[20];
check cword;
check cchar[20];
};
void main()
{
ifstream fin("Book.txt");
char ch;
char wrd[20];
time_t start,end;
double dif;
while(!fin.eof())
{
fin>>wrd;
cout<<wrd<<" ";
}
cout<<endl;
fin.close();
ofstream fout("Typed.txt");
time (&start);
while(ch!='0')
{
ch=getche();
if(ch!='0')
fout<<ch;
}
time (&end);
cout<<"\n Please wait while we process your result. \n";
dif = difftime (end,start);
fout.close();
checking();
display(dif);
}
void checking()
{
words w;
char wrd[20];
ifstream fin("Book.txt");
ifstream type("Typed.txt");
fstream fout;
fout.open("Corrected.dat",ios::out);
int i,j,k,l;
while(!type.eof())
{
fin>>wrd;
type>>w.word;
j=0;
k=0;
l=strlen(w.word);
for(i=0;w.word[i]!='\0';i++)
{
rajat:
if(w.word[i]==wrd[j])
w.cchar[i]=correct;
else
{
w.cchar[i]=incorrect;
k++;
if(i!=l)
{
i++;
goto rajat;
}
else
i=j;
}
j++;
}
if(k==0)
w.cword=correct;
else{
w.cword=incorrect;
}
fout.write((char*)&w,sizeof(w));
}
fin.close();
type.close();
fout.close();
}
void display(double dif)
{
HANDLE hConsole;
hConsole = GetStdHandle (STD_OUTPUT_HANDLE);
fstream fin;
fin.open("Corrected.dat",ios::in);
words w;
cout<<"\n You took "<<dif<<" seconds to enter the
text.";
cout<<"\n The typed text with mistakes are highlighted
in red. \n";
while(fin.read((char*)&w,sizeof(w)))
{
if(w.cword==correct)
{
SetConsoleTextAttribute
(hConsole, FOREGROUND_BLUE |
FOREGROUND_INTENSITY);
cout<<w.word;
}
else
{
for(int i=0;w.word[i]!='\0';i++)
{
if(w.cchar[i]==correct)
{
SetConsoleTextAttribute
(hConsole, FOREGROUND_BLUE |
FOREGROUND_INTENSITY);
cout<<w.word[i];
}
else
{
SetConsoleTextAttribute
(hConsole, FOREGROUND_RED |
FOREGROUND_INTENSITY);
cout<<w.word[i];
}
}
}
cout<<" ";
}
SetConsoleTextAttribute
(hConsole, FOREGROUND_RED | FOREGROUND_GREEN |
FOREGROUND_BLUE );
cout<<endl;
//**************************************************************************
//
END OF PROJECT
//**************************************************************************
OUTPUT
SCREENSHOT
BIBLIOGRAPHY
www.google.com
www.cpp4u.com
www.cppforschool.com
Sumita Aroras Class XII Computer
Science Text Book