I have to convert a capitalized character to its NATO phonetic alphabet counterpart. Using two arrays.
letters.txt is a text file with letters A-Z
words.txt is a text file with the NATO phonetic alphabet Alpha-Zulu
(Ex: A=Alpha, B=Bravo...)
The problem I have is that every time a letter is converted only Zulu is printed.
What do I have to add or change to this program so it can convert correctly?
Here is the code
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;
int main()
{
ifstream inputFile;
inputFile.open("words.txt");
string word;
while (inputFile >> word)
{
}
inputFile.open("letters.txt");
char letter;
while (inputFile >> letter)
{
}
char choice;
char letter2;
char Alpha[26]={letter};
string Words[26]={word};
do
{
cout<<"\nPlease enter a letter"<<endl;
cout<<"Letter: ";
cin>>letter2;
for(int count=0; count < 26; count++)
{
cout<< Words[count];
}
cout<<"\nDo you want to run this program again? <y/n>"<<endl;
cin>>choice;
}
while(choice=='y' || choice=='Y');
return 0;
}