ローマ字変換アルゴリズムを教えてください。
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
wchar_t t[50][5]={
L"あ",L"い",L"う",L"え",L"お",
L"か",L"き",L"く",L"け",L"こ",
L"さ",L"し",L"す",L"せ",L"そ",
L"た",L"ち",L"つ",L"て",L"と",
L"な",L"に",L"ぬ",L"ね",L"の",
L"は",L"ひ",L"ふ",L"へ",L"ほ",
L"ま",L"み",L"む",L"め",L"も",
L"や",L" ",L"ゆ",L" ",L"よ",
L"わ",L" ",L"を",L" ",L"ん"
};
char t2[50][3]={
"a ","i ","u ","e ","o ",
"ka","ki","ku","ke","ko",
"sa","si","su","se","so",
"ta","ti","tu","te","to",
"na","ni","nu","ne","no",
"ha","hi","hu","he","ho",
"ma","mi","mu","me","mo",
"ya"," ","yu"," ","yo",
"wa"," ","wo"," ","nn"
};
wchar_t *henkan()
{
wchar_t str[150];
char str2[300];
int i=0;
int j;
scanf("%s",&str2);
while(str2[i])
{
for(j=0;j<50;j++)
{
if(strcmp(str2,t2[j])==0)
{
str[i]=t[j];
str[i+1]='\0';
}
}
i+=2;
}
printf("入力された文字は%sです。\n",str);
return str;
}
int main(void)
{
wchar_t str[1000];
while(1)
{
str=henkan();
}
return 0;
}
ローマ字から、ひらがなに変換するアルゴリズムを考えているのですが、
なかなかうまくいきません。このソースコードはコンパイルもできませんでした。
どうすれば、うまくいきますでしょうか?
お礼
再起動で直りました ありがとうございました