UVA 10082 :https://uva.onlinejudge.org/external/100/10082.pdf
/*simulation*/
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <string>
#define size_of_array(ary) sizeof(ary) / sizeof(ary[0])
using namespace std;
int main() {
// your code goes here
string str;
const char storage[] = "`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";
while (getline(cin,str)){
for (int i = 0; i < str.length(); i++)
{
if (str[i]==' ')
cout << " ";
for (int j = 0; j < size_of_array(storage); j++)
{
if (str[i] == storage[j])
cout << storage[j - 1];
}
}
cout << endl;
}
system("PAUSE");
}
/*simulation*/
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <string>
#define size_of_array(ary) sizeof(ary) / sizeof(ary[0])
using namespace std;
int main() {
// your code goes here
string str;
const char storage[] = "`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";
while (getline(cin,str)){
for (int i = 0; i < str.length(); i++)
{
if (str[i]==' ')
cout << " ";
for (int j = 0; j < size_of_array(storage); j++)
{
if (str[i] == storage[j])
cout << storage[j - 1];
}
}
cout << endl;
}
system("PAUSE");
}
留言
張貼留言