https://github.com/letmefly666/keyboarddistance
Calculate the distance between two keys.
https://github.com/letmefly666/keyboarddistance
keyboard
Last synced: about 2 months ago
JSON representation
Calculate the distance between two keys.
- Host: GitHub
- URL: https://github.com/letmefly666/keyboarddistance
- Owner: LetMeFly666
- License: gpl-3.0
- Created: 2022-08-29T06:52:03.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-08-29T07:29:58.000Z (almost 4 years ago)
- Last Synced: 2025-12-28T19:46:34.374Z (6 months ago)
- Topics: keyboard
- Language: C++
- Homepage: https://keyboarddistance.letmefly.xyz
- Size: 19.5 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# KeyboardDistance
Calculate the distance between two keys.(计算两个按键之间的距离。)
Project URL:(项目地址:) [https://github.com/LetMeFly666/KeyboardDistance](https://github.com/LetMeFly666/KeyboardDistance)
Online Address: (在线地址:) [https://keyboarddistance.letmefly.xyz](https://keyboarddistance.letmefly.xyz)
---
## Introduction(介绍)
The keyboard looks like:(键盘形状如下:)
```
┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
│ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │
└┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┘
│ A │ S │ D │ F │ G │ H │ J │ K │ L │
└─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┘
│ Z │ X │ C │ V │ B │ N │ M │
└───┴───┴───┴───┴───┴───┴───┘
```
We define that the minimum distance of two key which have the same border is 2.(我们定义:具有公共边的两个按键的最短距离为1)
For example, The keys with the shortest distance of 2 from F are R, T, G, V, C, and D.(例如,和F最短距离为2的按键有R、T、G、V、C和D)
## Usage(用法)
Use the ```keyboarddistance``` class in ```main.cpp``` directly.(直接使用```main.cpp```里的```KeyboardDistance```类即可。)
```cpp
KeyboardDistance kd;
char a, b;
while (cin >> a >> b) {
cout << kd.getDistance(a, b) << endl;
}
```