help for the program for water tank

Does that compile? Does it do what you want? Did you have a question?

     int a,b,c,d;

Local variables are not initialized. These contain whatever junk was in memory.

  int index = a*8 + b*4 + c*2 + d;

Now, what do you suppose index equals?