Answer:
Here is the C++ program:
#include<iostream> //to use input output functions
using namespace std; //to identify objects like cin cout
int main() { //start of main function
char input; // to store the input letter
string output; // to store the corresponding ICAO
string ICAO[26] = {"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"}; // array of ICAO words
cout << "Enter a letter: " << endl; //prompts user to input a letter
cin >> input; //reads input letter from user
cout<<"You entered: "<<input<<endl; // prints the letter input by user
char letter; //declare a variable to hold the input letter
letter = tolower(input); //converts the input letter to lowercase
if(isalpha(letter)) //checks if the input is an alphabetic letter
{cout << "The corresponding International Civil Aviation Organization (ICAO) alphabet word: "; //prints this message
output = ICAO[letter - 'a']; //computes the corresponding ICAO for input letter
cout << output; } //prints the corresponding ICAO of input letter
else //if input is not a letter
cout << "Error: " << input << " is not a letter!" << endl; } //displays this error message
Step-by-step explanation:
The program first prompts the user to input a letter. It then converts the letter to lower case if the input letter is an uppercase letter. It stores that letter to letter variable. Now it checks whether the letter is an alphabet by using isalpha() method that return true if the letter is an alphabet. If the letter is an alphabet then it computes its corresponding ICAO by looking in to the ICAO array for the input letter. It then displays its corresponding ICAO word. If the value of letter is not an alphabet i.e. when isalpha returns false then else part is executed which displays an error message. The program along with its output is attached in a screenshot.