have a problem with array and string output

Hello, I have to write a program that takes in a string and outputs the ICAO words. We are using array, and index the array by positioning of the letter. I wrote the program and it all works except of one glitch I have.
As long as the string input is letters it prints everything out just fine. However, when there is a number mixed in to it, it outputs the previous letter after skipping the number.

Example:
Input ICAO string:
FREE4ALL
Your Phonetic version is: Foxtrot Romeo Echo Echo
Skipped letter: 4
Echo Alpha Lima Lima


I made my program with a while loop that continuous until the user chooses to exit. I am not sure if my teacher actually wants a continuous loop or not. I did write the program also with just a simple” for loop“ and the “If loop” to skip non letters but it still does the same. This is really boggling my mind can anyone tell me what I should do. Here is my code. Thanks

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <iostream>
#include <iomanip>
#include <string>
#include <cctype>
using namespace std;

int main()
{	//Aray decloration of ICAO words stored between Index[0] - Index[26]
	string wordICAO[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"};
		
	string instring;                                                                      //string input
	string outstring;																	  //string output
	char letter ;																	      //character of string
         int index = 0;																		  //loop control and index variable
	int len;																			  //integer of length and position of first character
	
	cout<< "Enter a word for ICAO spelling" << endl;									  //prompt user for input of word
	getline(cin, instring);                                                               //read data string
	len = instring.length() ;                                                             //len = number of char in string

	cout << endl << "Phonetic version is: " << setw(6);

	while (instring !="Quit"|| instring != "quit" || instring !="QUIT")
	{																			
		
		for(int index = 0;index < instring.length();index ++)							  //for loop index is less than or equal to string length
		{
		letter = instring[index];													      //converts string into individual char
		letter = toupper(letter);                                                         //char is converted to uppercase                        
				
			if(isalpha(letter) == 0)													  //will skip none letter characters
			{													
			cout << endl << "will skip letter : " << letter << endl;
			}

		else
		outstring = wordICAO[letter-'A'];												  //subtracts 'A' from uppercase letter to get words postion
		cout << outstring << " ";														  //prints out string of ICAO words					      

		}
	cout << endl << endl << "Enter a word for ICAO spelling" << endl;					  //prompt user for input of word
	cout << "Enter \"Quit\" to Exit program" << endl<< endl;
	getline(cin, instring);                                                               //read data string
	
	while (instring =="Quit" || instring == "quit" || instring =="QUIT" )
	{
		cout << "Goodby" << endl;
		cout << endl;	
		system("pause");
		return 0;
	}
	len = instring.length() ;                                                            
	cout << endl << "Phonetic version is: " << setw(6);
	}
	
}
Figured it out myself. Thank you
Topic archived. No new replies allowed.