zoj 1884 || poj 2538 WERTYU(这水让我很YM!)
2010-11-12 21:01
253 查看
输出键盘字符前的那个字符。
开始想,难不能我要用N个case of? = =
后来想通了,把键盘上字符都按顺序存到字符串数组里。。。
少存了 - = WA了数次 !
我了个去!!
学习了一点,scanf可以吃控制字符(空格回车tab等等)。。。 cin不吃。。。
还有str数组里的/,得写俩。。。要不有警告。。。
开始想,难不能我要用N个case of? = =
后来想通了,把键盘上字符都按顺序存到字符串数组里。。。
少存了 - = WA了数次 !
我了个去!!
学习了一点,scanf可以吃控制字符(空格回车tab等等)。。。 cin不吃。。。
还有str数组里的/,得写俩。。。要不有警告。。。
#include <stdio.h> #include <stdlib.h> #include <iostream> #include <string.h> using namespace std; int main(void) { char ch; char str[] = {"`1234567890-=QWERTYUIOP[]//ASDFGHJKL;'ZXCVBNM,./"}; char text[10000]; int len = strlen(str); while( gets(text) ) { for(int k=0; k<strlen(text); k++) { if( text[k] == ' ' ) cout << text[k]; for(int i=0; i<len; i++) { if( text[k] == str[i] ) cout << str[i-1] ; } } cout << endl; } return 0; }
相关文章推荐
- poj 2538 WERTYU
- POJ 2538 WERTYU水的问题
- poj 2538 WERTYU
- poj 2538 WERTYU
- POJ 2538 WERTYU(打错字符——制表)
- poj 2538 WERTYU
- POJ 2538 WERTYU(我的水题之路——键盘错位)
- ZOJ Problem Set–1884 WERTYU
- POJ 2538 WERTYU(水~)
- zoj 1884 WERTYU
- POJ 2538 WERTYU 模拟
- poj 2538 WERTYU
- POJ 2538 WERTYU(水题)
- POJ 2575 && ZOJ 1879 Jolly Jumper(整数序列)
- zoj 1025 || poj 1065 Wooden Sticks(DP做法)
- ZOJ 2165 POJ 1979 Red and Black DFS水题
- POJ 1459 & ZOJ 1734 Power Network (网络最大流)
- zoj 1884 简单 键盘 字符 处理
- ZOJ1082 POJ1125 Stockbroker Grapevine,Dijkstra 算法
- POJ1003 UVALive2294 HDU1056 ZOJ1045 Hangover【数学计算+水题】