2014년 5월 7일 수요일

[일기] 1002 하급 난이도.

#include <iostream>

using namespace std;

void getStarted();

int main(int argc, char* argv[]){
getStarted();
}
void getStarted(){
char str[80];
cin>>str;
char replaced;
int newIndex = 0;
for (int i = 0; i < 80-3; i++)
{
if( str[i] == '\0' ){
//cout<<"EndByNull"<<i;
str[newIndex] = '\0';
break;
}else if(str[i] == '%'){
i+=2;
switch(str[i]){
case '0':
replaced = ' ';
break;
case '1':
replaced = '!';
break;
case '4':
replaced = '$';
break;
case '5':
replaced = '%';
break;
case '8':
replaced = '(';
break;
case '9':
replaced = ')';
break;
case 'a':
replaced = '*';
break;
}
} else {
replaced = str[i];
}
str[newIndex++]=replaced;
}
cout<<str<<endl;
}

댓글 없음:

댓글 쓰기