1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
#include <iostream>
#include <string>
#include <map>
using namespace std;
string ICAO[] = { "Alpha", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot", "Golf", "Hotel", "India", "Juliet", "Kilo", "Lima", "Mike",
"November", "Oscar", "Papa", "Quebec", "Romeo", "Sierra", "Tango", "Uniform", "Victor", "Whiskey", "X-ray", "Yankee", "Zulu" };
int main()
{
map<char,string> M;
for ( int i = 0; i < 25; i++ ) M['a'+i] = M['A'+i] = ICAO[i];
string word, phonetic;
cout << "Enter a single word to be converted to the phonetic alphabet: ";
getline( cin, word );
for ( char c : word ) if ( M.count(c) ) phonetic += M[c] + ' ';
cout << "Phonetic version of your word is: " << phonetic << '\n';
}
|