Digital keypad finger practice

xiaoxiao2021-03-06  75

The digital keypad finger practice is a small software used to practice the finger. I preparation this software because I have to participate in the college entrance examination in Sichuan Province this summer, my finger is too bad, the speed is too slow, but also Because the dissatisfaction with the software provided to practice the finger method, it is like this, in the college entrance examination, most of the scores do not bring a decimal point, with a decimal point is only .5 decimal point, and the software gives us the software is producing All of the data is available, such as: 52.1, 68.3, 69.4, etc., this can still endure, more people feel that the software has time limit, when we open it, it will be automatically closed, and the teacher gives Our prompt is to change the system time to finish the practice. I certainly don't fully understand this, so I wrote this software, I will introduce it to how I realize it, let's introduce it. Function, then introduce how to encode:

The software has the following functions:

1. The general function of the numeric key is practiced to be practiced.

2, with the "Option" parameter setting function, the option parameters are as follows:

A: Enter data: Does the data bring a decimal point, whether part of the data is included .5 decimal point, etc.

B: Test speed: keystroke speed and word speed

C: Other properties: Test time, display the delay time of the information of the input error, whether to shield the non-numeric key

3, have the "Option" parameter memory function, it can remember the user's last option setting, which will initialize the program according to the user's last setting

Data generation:

Since it is a numeric key, the source of data is definitely the weight, I am implemented by a function, which generates data that meets the requirements based on the accepted parameters, where Random () is used This function creates a random number, and the code is as follows:

ANSISTRING __FASTCALL TFRMMAIN :: RandNum (INT FLAG)

{

// Todo: Add your source code here

Double Randnum;

Switch (flag)

{

Case 1: // All numbers do not have decimal points

RandNum = random (100);

Break;

Case 2: // Some numbers have decimal points

RandNum = Random (100);

IF (rand ()% 2)

{

RandNum = RandNum (Rand ()% 10) / Double (10);

}

Break;

Case 3:

RandNum = Random (100);

RandNum = RandNum (Rand ()% 10) / Double (10);

Break;

Case 4:

RandNum = Random (100);

RandNum = randnum 0.5;

Break;

Case 5:

RandNum = Random (100);

IF (rand ()% 2)

{

RandNum = randnum 0.5;

}

Break;

DEFAULT: / / All numbers do not have decimal points

RandNum = Random (100);

}

Return Ansistring (RandNum);

}

Test speed:

The software speed test is divided into two types: keystroke speed and word speed, and keystroke speed represents the user's hit book of the user per minute, and the word speed represents the number of numbers entered by the user per minute, the test speed gets me. It is also implemented by a function, the function code is as follows:

Void __fastcall tfrmmain :: Stat (int flagspeed)

{

// Todo: add your source code: = timegettime () - DWTimeStart;

sttime-> caption = "remaining time:" Ansistring (TMTest-DwtimeLapse / 1000) "Second";

Switch (Flagspeed)

{

Case 1: // Key speed

IF (DwtimeLapse> 0)

{

Long int temp1 = (60 * 1000 * (numcount) / dwtimelapse);

Stspeed-> CAPTION = "Key Speed:" Ansistring (TEMP1) "/ Division";

// Record speed

RecSpeed ​​= TEMP1;

}

STWORDNUM-> CAPTION = "Number of keystrokes:" Ansistring (Numcount);

Break;

Case 2: // word speed

IF (DwtimeLapse> 0)

{

Long int temp2 = (60 * 1000 * (numcount) / dwtimelapse);

Stspeed-> CAPTION = "Word Speed:" Ansistring (TEMP2) "/ Division";

// Record speed

RecSpeed ​​= TEMP2;

}

STWORDNUM-> CAPTION = "Word Number:" ANSISTRING (Wordnum);

// ShowMessage (FlagSpeed);

Break;

}

IF (Wordnum> 0)

{

Long int Temp = 100 * (Wordnum-Wrongnum) / WordNum

STCORRRATE-> CAPTION = "The correct rate:" Ansistring (TEMP) "%";

// Record the correct rate

Recctorrrate = TEMP;

}

Else

{

STCORRRRATE-> CAPTION = "The correct rate:" ANSISTRING (0) "%";

// Record the correct rate

Recctorrrate = 0;

}

}

The above code uses a Win32 API function TimegetTime (), its role is to obtain the time that the system starts to the time, in milliseconds, its statement is as follows:

DWORD TIMEGETIME (VOID);

"Option" parameter memory function:

The memory function of the specific parameter attribute of the software can be implemented. If you can pass the INI file, the general file to achieve the function of memory, you can also complete the function through the registry, I chose to pass the registration when I realize it. Table is realized, I mainly use the GetKeyValue () and setKeyValue () two functions to complete this feature, the functionality of getKeyValue () is the value of a key in the registry, and the function of setKeyValue () is set up the registry. The value code of one in the middle is as follows:

GetKeyValue () function:

Ansistring GetKeyValue (ANSISTRING RegPath, Ansistring Key)

{

// Todo: Add your source code here

Tregistry * registry = new tregistry;

ANSISUSTRING RESULT = ""

Try

{

Registry-> OpenKey (RegPath, False); Result = registry-> readstring (key);

}

__finally

{

Delete registry;

}

Return Result;

}

SetKeyValue () function:

Bool SetKeyValue (Ansistring Regpath, Ansistring Key, ANSISTRING VALUE)

{

// Todo: Add your source code here

Tregistry * registry = new tregistry;

Try

{

Registry-> OpenKey (RegPath, True);

Registry-> WriteString (key, value);

}

__finally

{

Delete registry;

}

Return True;

}

The above introduction is only the implementation of some of the more important functions in the software. In fact, as a software, it still has many aspects that can not be introduced or difficult to clear. If you are interested in the software, you can download all the source code of the software. Website: http://www.zccfamily.com/zqget/, it is developed with Borland C Builder, if you have any opinions or suggestions for this software, or want to discuss with me, if you exchange ideas, my contact information : email: zqget@msn.com

转载请注明原文地址:https://www.9cbs.com/read-120750.html

New Post(0)