I am in the early stages of making a program in C++ that replaces integer input with its english counterpart. I do not want instructions on how make this program, but rather, insight to how a certain portion of the code behaves a certain way, and perhaps tips how to fix it.

```
std::string strToEng(std::string s)
{
  int sInt = atoi(s.c_str());

  std::string digit1[] = {"zero", "one", "two", "three", "four", "five", "six", "seven",
                          "eight", "nine", "ten", "eleven", "twelve", "thirteen",
                          "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", 
                          "nineteen"};

  switch(s.size())
  {
    case 1:
    {
      int temp = int(s[0]);
      return digit1[temp];
    }
   }

  return "error";
}

```

The issue is with the digit1 array in the switch statement. When I compile this code, case 1 does not return the desired output. If I change digit1[temp] to some sort of constant(i.e. digit1[3]), it displays properly. Is there an issue with using a variable to index an array? How can I solve this?

EDIT:Perhaps deceptive that I have no way of handling digits higher than nine, yet they are still contained within digit1. The reason for this is that this code has been rewritten several times.