c_cpp 键盘打字 - GeeksforGeeks

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp 键盘打字 - GeeksforGeeks相关的知识,希望对你有一定的参考价值。

/*
http://ideone.com/x8u7yq
http://www.practice.geeksforgeeks.org/problem-page.php?pid=871
*/

#include <iostream>
#include <string>
#include <map>
using namespace std; 

int main() {
	int t;
	cin >> t;
	while(t--){
		string s;
		cin >> s;
		map<char, int> m;
		m['a'] = 2;
		m['b'] = 2;
		m['c'] = 2;
		
		m['d'] = 3;
		m['e'] = 3;
		m['f'] = 3;
		
		m['g'] = 4;
		m['h'] = 4;
		m['i'] = 4;
		
		m['j'] = 5;
		m['k'] = 5;
		m['l'] = 5;
		
		m['m'] = 6;
		m['n'] = 6;
		m['o'] = 6;
		
		m['p'] = 7;
		m['q'] = 7;
		m['r'] = 7;
		m['s'] = 7;
		
		m['t'] = 8;
		m['u'] = 8;
		m['v'] = 8;
		
		m['w'] = 9;
		m['x'] = 9;
		m['y'] = 9;
		m['z'] = 9;
		
		int len = s.size();
		for(int i=0; i<len; i++){
			cout << m[s[i]];
		}
		cout << endl;
	}
	return 0;
}

以上是关于c_cpp 键盘打字 - GeeksforGeeks的主要内容,如果未能解决你的问题,请参考以下文章

如何在 iphone 模拟器上使用键盘打字?

键盘输入盲打训练, 打字练习,打字游戏 打字教程推荐

键盘按键不能打字,很多键变成快捷键的解决方法

非英语键盘vim用户的轻松打字[关闭]

打字稿键盘事件:“事件”类型的参数不可分配给“键盘事件”类型的参数

1033 旧键盘打字