Have I achieved a null- terminated C-string through the code?

        if (a) {
          if (x == 0)
          {
            invalidCount();
          }
          else {
            lcd.clear();

Consistent placement of curly braces is a good thing. I prefer the middle style, with every { and every } on a line by itself. I can tolerate the first and last style. What I can't abide is MIXING styles.

What is the point in creating the variable val if you are never going to use it? THAT is what the compiler is asking you.

I do not like the use of count to hold the digits and val to hold the value. I'd prefer digits to hold the digits and count to hold the value.