c++ typing speed tester project using graphics.h header file


INTRODUCTION
I have made project “ Typing speed tester “. In this software we can test our speed and efficiency for typing via general keyboard. In this programme we have to type the characters which are displayed on the user screen.
Now, coming to technical aspects of this software, all data are maintained in binary files, concepts of function and little bit use of graphical colours.

LOGIN  INFORMATION
USERNAME:   jatin
PASSWORD:   password



Header Files
Ø iostream.h
Ø dos.h
Ø stdio.h
Ø conio.h
Ø time.h
Ø string.h
Ø stdlib.h
Ø "tt.h"

SOFTWARE RECQURIMENTS

OS:            Windows Platform
RAM:          512 MB
Processor:  Pentium 3 or Above
Compiler:    Turbo C++     or
                     Borland C++ 4.5

                                                                  OUTPUT








SOURCE CODE



/*        Project Name: Speed Tester

            Date        : 16/02/2016

            Developed By: Jatin Yadav

*/

#include<iostream.h>

#include<dos.h>

#include<stdio.h>

#include<conio.h>

#include<time.h>

#include<string.h>

#include<stdlib.h>

#include"tt.h"

void tscreen(char text[5][80]);

void initialize();

void line();

void line(int);

int a;

void main()

{          initialize();

            abc:

            textbackground(2);

            clrscr();

            box(1,1,80,20);

            gotoxy(2,2);line(1);

            gotoxy(2,4);line(1);

            gotoxy(36,3);

            textcolor(0+BLINK);

            cprintf("WELCOME");

            gotoxy(37,6);

            textcolor(BLUE);

            cprintf("LOGIN... ");

            box(25,7,57,15);

            gotoxy(29,8);

            cprintf("Username :- ");

            char username[20],password[20];

            char usr[]="jatin";

            char pwd[]="password";

            int i=0;

            textcolor(RED);

            cin>>username;

            gotoxy(29,10);

            textcolor(BLUE);

            cprintf("Password:- ");

            int p=0;

            textcolor(RED);

            do{

                        password[p]=getch();

                        if(password[p]=='\r')

                        break;

                        cprintf("*");

                        p++;

              }while(1);

              password[p]='\0';

             textcolor(RED);

             if((strcmp(username,usr)==0)&&(strcmp(password,pwd)==0))

            {

                        gotoxy(29,12);

                        cprintf("login successful ");

                        gotoxy(29,14);

                        cprintf("press any key to continue") ;

             }

             else

             {

                        gotoxy(29,12);

                         cprintf("Login insuccessful");

                        gotoxy(29,14);

                        cprintf("press enter key to continue");

                         int t=getch();

                        if(t=='\r')

                        goto abc;

                         else

                        exit(0);

              }

            getch();

            cho:

            clrscr();

            box(7,7,40,15);

             gotoxy(12,8);

             cprintf("Choose the level you want");

             gotoxy(12,10);

             textcolor(BLUE);

             cprintf("1. Easy");

             gotoxy(12,11);

             cprintf("2. Medium");

             gotoxy(12,12);

             cprintf("3. Hard");

             char easy[5][80]={"in call by value method of function call we pass value in ",

                          "the function arguement.If we make any updation in the formal ",

                          "parameter it does not reflect in the variable passed in ",

                          "actual parameter. In this method we can pass value in the ",

                          "form of constant or variable."};

             char medium[5][80]={"What is difference Between (+,-,*,/,%) ",

                            "(+) Means to Add Two Numbers ",

                            "(-) Means To Subtract Two Numbers ",

                            "(*) Means To Multiply Two Numbers ",

                            "(%) It Is Modulus function "};

 

             char hard[5][80]={"My Email Id is JatinYadav936@gmail.com ",

                             "I Often Used To Chat With My Friends from This ID ",

                             "But I'am Not Using This ID# Because My Exams are Going On!!!!! ",

                             "I Think That I will Use My Id On The Date 25 Dec 2017 @ 21:00 ",

                             "I Have A chat Group Of My Own Which Is Consist Of 324 Members "};

             char choose=getch();

             switch(choose)

             {          case '1': tscreen(easy);

                                    break;

                        case '2': tscreen(medium);

                                    break;

                        case '3': tscreen(hard);

                                    break;

                        default : cprintf("Invalid Input");goto cho;

             }

             getch();

}

void tscreen(char text[5][80])

{

            clrscr();

            int w=0,mistakes=0,letters=0,last1,last=0;

            char k,ch;

             textcolor(RED);

             box(1,1,80,20);

            for(int i=0;i<5;i++)

            {          textcolor(1);

                        gotoxy(2,(1+i)*3+2);

                        cprintf(text[i]);

            }

            textcolor(LIGHTGREEN);

            time_t t1,t2;

            t1=time(NULL); int n;

            for(i=3,n=0;i<=15;i+=3,n++)

            {

                        last=0;

                        k=2;

                        do{

                                    if(ch==27)

                                    {

                                                box(31,9,47,11);

                                                gotoxy(34,10);

                                                textcolor(RED+BLINK);

                                                cprintf(" PAUSED.....");

                                                textcolor(LIGHTGREEN);

                                    }

                                    last1=strlen(text[n]);

                                    gotoxy(k,i+3);

                                    ch=getche();

                                    if(ch=='\r')

                                    {           goto end;  }

                                    if(text[i/3-1][k-2]!=ch && ch!='\r'&& ch!=8)

                                    {           gotoxy(k,i+1);

                                                textcolor(RED);

                                                putch(25);

                                                mistakes++;

                                                textcolor(LIGHTGREEN);

                                    }

                                    if(ch=='\b')

                                    {           k--;

                                                gotoxy(k,i+3);

                                                putch(' ');

                                                gotoxy(k,i+1);

                                                putch(' ');

                                    }

                                    else

                                    k++;

                                    if(ch==32||ch==13)

                                    w++;

                                    if(ch!='\b')

                                    ++last;

                                    else

                                    --last;

                        }while(last!=last1);

                        end:

            }

            t2=time(NULL);

            float s=t2-t1;

            gotoxy(2,22);

            cout<<s<<" seconds";

            int speed=w/(s/60);

            gotoxy(2,23);

            cout<<"speed="<<speed<<" words per minute";

            gotoxy(2,24);

            cout<<"No. Of Mistakes= "<<mistakes;

            for(int m=0;m<5;m++)

            {           letters+=strlen(text[m]);  }

            gotoxy(2,25);

            cout<<"% mistakes="<<(mistakes*100/letters)<<"%";

 

}

void line()

{           for(int k=0;k<80;k++)

            {           cout<<"*";   }

}

 

void line(int)

{           for(int k=0;k<78;k++)

            {           cprintf("*"); }

}

void initialize()

{           textbackground(0);

            clrscr();

            gotoxy(1,9);

            line();

            line();

            gotoxy(34,10);

            textcolor(RED);

            cprintf("Initializing ");

            gotoxy(1,12);

            line();

            line();

            line();

            gotoxy(30,11);

            for(int l=0;l<10;l++)

            {       cprintf("* ");

                        sleep(1);

            }

}

 if any doubts or queries please comment 🙂

Comments

Post a Comment

Popular posts from this blog

Python and C++ program to implement multiplication of 2d array (Matrix multiplication)

How to find and replace a node in Linked List

What is AI (Artificial Intelligence )? and its characteristics