Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C++ function that takes an alphabetic character and returns the correspo

ID: 3620907 • Letter: W

Question

Write a C++ function that takes an alphabetic character and returns the corresponding International Civil Aviation Organization alphabet word(these are the words that pilots use when they need to spell something out over a noisy radio channel.).

Return the word as a string type. To use strings in a program you will need #include in it.

Write a main program that asks the user for a word. It will input the word, reading characters until it reaches a non-alphabetic character. It will then output the word spelled in the ICAO code


The alphabet is as follows:

A Alpha
B Bravo
C Charlie
D Delta
E Echo
F Foxtrot
G Golf
H Hotel
I India
J Juliet
K Kilo
L Lima
M Mike
N November
O Oscar
P Papa
Q Quebec
R Romeo
S Sierra
T Tango
U Uniform
V Victor
W Whiskey
X X-ray
Y Yankee
Z Zulu

Explanation / Answer

please rate- thanks

#include <iostream>
#include <string.h>
using namespace std;
string lookup(char);
int main()
{char word;
cout<<"Enter a word: ";
word=getchar();
while(word>='a'&&word<='z'||word>='A'&&word<='Z')
   {                                   
     cout<<lookup(word);
     word=getchar();
     }

cout<<endl;
system("pause");
return 0;
}
string lookup(char a)
{switch(a)
       {case 'A':case 'a': return "Alpha ";     
         case 'B':case 'b': return "Bravo ";                 
         case 'C':case 'c': return "Charlie ";
         case 'D':case 'd': return "Delta ";                 
         case 'E':case 'e': return "Echo ";                 
          case 'F':case 'f': return "Foxtrot ";                 
          case 'G':case 'g': return "Golf ";                 
           case 'H':case 'h': return "Hotel ";                 
          case 'I':case 'i': return "India ";                 
          case 'J':case 'j': return "Juliet ";                 
           case 'K':case 'k': return "Kilo ";                 
          case 'L':case 'l': return "Lima ";                 
           case 'M':case 'm': return "Mike ";                 
            case 'N':case 'n': return "November ";                                                                                                        
             case 'O':case 'o': return "Oscar ";                      
             case 'P':case 'p': return "Papa ";                      
              case 'Q':case 'q': return "Quebec ";                     
              case 'R':case 'r': return "Romeo ";                     
              case 'S':case 's': return "Sierra ";                     
              case 'T':case 't': return "Tango ";                     
              case 'U':case 'u': return "Uniform ";                   
              case 'V':case 'v': return "Victor ";                 
              case 'W':case 'w': return "Whiskey ";                 
             case 'X':case 'x':return "X-ray ";                 
              case 'Y':case 'y': return "Yankee ";                 
              case 'Z':case 'z': return "Zulu ";                                                 
       }
}


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote