Help with C programming

I have a car that needs to stop at a place whenever I press a key on keyboard. So if I press 1, it should stop at coordinate X = 140 and coordinate Y = 50. On this code, the speed goes up and down with UP and DOWN arrow. I may to insert if statement under case 1. I need your help.

/

/ GPS
WbDeviceTag gps;
double gps_coords[3] = {0.0, 0.0, 0.0};
double gps_speed = 0.0;

// misc variables
double speed = 0.0;
double steering_angle = 0.0;
int manual_steering = 0;
bool autodrive = true;

void print_help() {
 printf("You can drive this car!\n");
 printf("Select the 3D window and then use the cursor keys to:\n");
 printf("[LEFT]/[RIGHT] - steer\n");
 printf("[UP]/[DOWN] - accelerate/slow down\n");
}

void set_autodrive(bool onoff) {
 if (autodrive == onoff)
   return;
 autodrive = onoff;
 switch (autodrive) {
   case false:
     printf("switching to manual drive...\n");
     printf("hit [A] to return to auto-drive.\n");
     break;
   case true:
     if (has_camera)
       printf("switching to auto-drive...\n");
     else
       printf("impossible to switch auto-drive on without camera...\n");
     break;
 }
}


void check_keyboard() {
 int key = wb_keyboard_get_key();
 switch (key) {
   case WB_KEYBOARD_UP:
     set_speed(speed + 5.0);
     break;
   case WB_KEYBOARD_DOWN:
     set_speed(speed - 5.0);
     break;
   case WB_KEYBOARD_RIGHT:
     change_manual_steer_angle(+1);
     break;
   case WB_KEYBOARD_LEFT:
     change_manual_steer_angle(-1);
     break;
   case 'A':
     set_autodrive(true);
     break;
   case '1':
     [b]if (gps_coords[X] == "104.9" && gps_coords[Z] == "48.9") {
      set_speed(speed - speed);[/b]
 }
    break;
}

jpt123:
I need your help.

1.) Do you have a specific question?
2.) This is C++, not C

Code wont compile in the Arduino IDE ?

This won't work unless the car is already at the required position, and the chances of that are slight

  case '1':
     if (gps_coords[X] == "104.9" && gps_coords[Z] == "48.9") {
        set_speed(speed - speed);[
     }
    break;

If you want to stop the car where it is now then just set the speed to zero regardless of the GPS position.

If you want the car to move to a specific GPS position (somewhere over there --->) when you press the button then you will need code that is a great deal more complex.

...R

double gps_coords[3];

if (gps_coords[X] == "104.9" && gps_coords[Z] == "48.9") {
      set_speed(speed - speed);

A double or float variable is NEVER going to be equal to a string constant. If you take the quotes off of those numbers they will at least be float constants which can be compared to other float values.