From c66ff2b0bb4204841a553f47da0db513422df51f Mon Sep 17 00:00:00 2001 From: Philipp Reh Date: Sat, 1 Aug 2009 20:21:43 +0200 Subject: [PATCH] Erase \1 after a, i, u, e, o. --- kana2romaji.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/kana2romaji.cpp b/kana2romaji.cpp index 7024f3f..ac239f8 100644 --- a/kana2romaji.cpp +++ b/kana2romaji.cpp @@ -408,6 +408,7 @@ void kana2romaji(const string& kana, string& rom) { ? 3 : 2); pos -= 2; + continue; } else if( pred == "fu" || @@ -417,6 +418,7 @@ void kana2romaji(const string& kana, string& rom) { { remove_quote_1(pos, rom); pos -= 2; + continue; } else if( pred == "su" || @@ -430,6 +432,8 @@ void kana2romaji(const string& kana, string& rom) { { rom[pos - 1] = 'w'; rom.erase(pos); + --pos; + continue; } else if( pred == "to" || @@ -438,11 +442,27 @@ void kana2romaji(const string& kana, string& rom) { { rom[pos - 1] = 'h'; rom.erase(pos); + --pos; + continue; } - else - { - cout << "Encountered a special character in " << kana << " but don't know what to do with it.\n"; - } + } + + if (pos > 0) { + char const pred = rom[pos - 1]; + + switch(pred) + { + case 'a': + case 'i': + case 'u': + case 'e': + case 'o': + rom.erase(pos); + --pos; + continue; + default: + cout << "Encountered a special character in " << kana << " but don't know what to do with it.\n"; + } } else { -- 2.30.2