kmitl-profund-exercise/karaca-decode/main.cpp

26 lines
684 B
C++
Raw Normal View History

2023-04-02 18:10:40 +00:00
#include<stdio.h>
int main() {
char reversed[1003],originalInput[1000];
int length=0;
printf("Input: ");
scanf("%s", reversed);
while(reversed[length]!='\0'){
length++;
}
length=length-3;
reversed[length]='\0';
for(int i=0;i<length;i++){
if(reversed[i]=='0') reversed[i]='a';
else if(reversed[i]=='1') reversed[i]='e';
else if(reversed[i]=='2') reversed[i]='i';
else if(reversed[i]=='3') reversed[i]='o';
else if(reversed[i]=='4') reversed[i]='u';
}
for(int i=0;i<length;i++){
originalInput[length-i-1]=reversed[i];
}
printf("\nOutput: %s\n", originalInput);
return 0;
}