U E D R , A S I H C RSS

Map연습문제/임민수

~cpp 
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

void main()
{
	char input[100];
	cin.getline(input,100);

	map<char,char> rule1, rule2, rule3;
	rule1['b']='1';         rule2['1']='z';         rule3['z']='a'; 
    rule1[' ']='2';         rule2['2']='x';         rule3['x']='b'; 
    rule1['z']='3';         rule2['3']=' ';         rule3[' ']='c'; 
    rule1['a']='4';         rule2['4']='y';         rule3['y']='d'; 
    rule1['y']='5';         rule2['5']='a';         rule3['a']='e'; 
    rule1['x']='6';         rule2['6']='w';         rule3['w']='f'; 
    rule1['i']='7';         rule2['7']='v';         rule3['v']='g'; 
    rule1['h']='8';         rule2['8']='u';         rule3['u']='h'; 
    rule1['g']='9';         rule2['9']='b';         rule3['b']='i'; 
    rule1['\n']='0';        rule2['0']='t';         rule3['t']='j'; 
    rule1['c']='!';         rule2['!']='s';         rule3['s']='k'; 
    rule1['f']='@';         rule2['@']='c';         rule3['c']='l'; 
    rule1['e']='#';         rule2['#']='r';         rule3['r']='m'; 
    rule1['d']='$';         rule2['$']='o';         rule3['o']='n'; 
    rule1['w']='%';         rule2['%']='d';         rule3['d']='o'; 
    rule1['u']='^';         rule2['^']='p';         rule3['p']='p'; 
    rule1['v']='&';         rule2['&']='e';         rule3['e']='q'; 
    rule1['j']='*';         rule2['*']='q';         rule3['q']='r'; 
    rule1['k']='(';         rule2['(']='l';         rule3['l']='s'; 
    rule1['l']=')';         rule2[')']='m';         rule3['m']='t'; 
    rule1['m']='<';         rule2['<']='f';         rule3['f']='u'; 
    rule1['n']='>';         rule2['>']='g';         rule3['g']='v'; 
    rule1['o']='?';         rule2['?']='\n';        rule3['\n']='w'; 
    rule1['p']='{';         rule2['{']='h';         rule3['h']='x'; 
    rule1['t']='}';         rule2['}']='i';         rule3['i']='y'; 
    rule1['s']='=';         rule2['=']='j';         rule3['j']='z'; 
    rule1['q']='+';         rule2['+']='k';         rule3['k']='2'; 
    rule1['r']='-';         rule2['-']='n';         rule3['n']='\n'; 

	vector< map<char, char> > vector_map;
	vector_map.push_back(rule1);
	vector_map.push_back(rule2);
	vector_map.push_back(rule3);

	for(int i=0; i<100; i++)
	{
		char temp = input[i];
		for(vector< map<char, char> >::iterator j = vector_map.begin(); j<vector_map.end(); j++)
		{
			temp = (*j)[temp];
		}
		cout << temp;
	}
	cout << endl;
	

}



블스캠프2004/목요일
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:44
Processing time 0.0082 sec