Arduino Tables

Hello,
I am far from being expert in Arduino, I am a beginner. That's why I need your help.
I have to code a game in which I have to fire five shots at a target.

  1. Before each shot, I have to reset the starting time (TimeInitTir)

  2. When the target is hit, the time is stopped and the time measured with this formula: TimeTir1 - millis()-TimeInitTir.

  3. Then I convert this time into minutes, seconds, and milliseconds, and I display it on the LCD screen.

Steps 1, 2, 3 are repeated for the 5 shots.

At the end of the five shots, I have to:

a. Calculate the total time (TimeTotal + TimeTir1 + TimeTir2 + TimeTir3 + TimeTir4 + TimeTir5) and I also display it on the LCD screen.

b. Determine the index of the shot that has the smallest time and display it with the time (Example: "Best shot: shot 1" and "Time: 00:07:45")

Here is my code:

void Tir1() {

  PonctuationTime1();
  lcd.setCursor(18,1);
  lcd.print(" ");
  lcd.setCursor(18,2);
  lcd.write(4);

  TimeInitTir1 = millis();

   while (1) {

     if (digitalRead(BoutonSELECT) == HIGH){
          Serial.println('Z');
          delay(wait500);
          finChrono5tirs(); } 

     if (Serial.available()>0) {
        received = Serial.read();
       
       if(received ='A'||'B'||'C'||'D'||'E'||'F')
           {tone(Buzzer, freq500, dur100);
            Zone1++;
            TimeTir1 = (millis() - TimeInitTir1 );
            
			// convert time to minutes, seconds, milliseconds
			// conversion temps en minutes, secondes, millisecondes
			TimeSec1 = (TimeTir1 /1000)%60;
			TimeMil1 = (TimeTir1 %1000)/10;
			TimeMin1 = (TimeTir1 /1000)/60;
			
            // display time min, sec, mill on the LCD
			// affichage du temps min, sec, mill sur l'écran LCD
			lcd.setCursor(0,1);
			lcd.print("Tps1:");
			lcd.setCursor(13,1);

			lcd.print(" sec");
			lcd.setCursor(7,1);
			lcd.print(":"); 
			lcd.setCursor(10,1);
			lcd.print("."); 

			if (TimeMin1 >= 10 ) {
			lcd.setCursor(5,1);
			lcd.print(TimeMin1, DEC); }

			if (TimeSec1 >= 10 ) {
			lcd.setCursor(8,1);
			lcd.print(TimeSec1], DEC); }

			if (TimeMil1 >= 10 ) {
			lcd.setCursor(11,1);
			lcd.print(TimeMil1, DEC); }                                 

			if (TimeMin1 < 10 ) {
			lcd.setCursor(5,1);
			lcd.print("0");
			lcd.setCursor(6,1);
			lcd.print(TimeMin1, DEC); } 

			if (TimeSec1 < 10 ) {
			lcd.setCursor(8,1);
			lcd.print("0");
			lcd.setCursor(9,1);
			lcd.print(TimeSec1, DEC); }

			if (TimeMil1 < 10 ) {
			lcd.setCursor(11,1);
			lcd.print("0");
			lcd.setCursor(12,1);
			lcd.print(TimeMil1, DEC); }
			
			//=====================================
			
            lcd.setCursor(18,1);
            lcd.print(" ");
            lcd.setCursor(18,2);
            lcd.write(4);

            TimeTotal= TimeTir1 + TimeTir2 + TimeTir3 + TimeTir4 + TimeTir1;

            }
      } // fin if(Serial...
  } // fin while
}

And where is the rest of the code? That's nothing like a complete program.

When you do post the whole program don't forget to tell us not only what you want it to do but what it actually does now.

Steve