#include #include #include using namespace std; int main() { const string eng[] { "a","i","u","e","o", "ka","ki","ku","ke","ko", "sa","shi","su","se","so", "ta","chi","tsu","te","to", "na","ni","nu","ne","no", "ha","hi","fu","he","ho", "ma","mi","mu","me","mo", "ya","yu","yo", "ra","ri","ru","re","ro", "wa","wo","n" }; const string jap[] { "あ","い","う","え","お", "か","き","く","け","こ", "さ","し","す","せ","そ", "た","ち","つ","て","と", "な","に","ぬ","ね","の", "は","ひ","ふ","へ","ほ", "ま","み","む","め","も", "や","ゆ","よ", "ら","り","る","れ","ろ", "わ","を","ん" }; const size_t n {size(eng)}; string romaji {}; cout << "Enter romaji (Japanese typed with ENG characters): "; cin >> romaji; bool match {false}; for (size_t i {0}; i < n; ++i) { //used size_t i instead of int i because were checking it against size_t n. Not sure if this is necessary but it makes sense in my mind if (romaji == eng[i]) { match = true; cout << jap[i] << " is the Japanese character for " << eng[i] << ".\n"; break; //we check if eng[i] and the user entered romaji is == and then output jap[i], the japanese equivalent of eng[i]. //the break allows me to stop the looped search for romaji == eng[i] } } if (!match) { cerr << "Brush up on your Japanese because that IS NOT valid romaji!\n"; } return EXIT_SUCCESS; }