Arduino Control Relay code

Hi everybody
I am a novice, and also an apprentice with ardruino, currently I have a code and a sample test software, when I program to relay close in the order. Only Relay No. 1 is OK, and the other relay when closed, immediately back to close Relay No. 1. I do not know how to handle the code is looking forward to the help of everyone. thank you
My code is as follows
void setup () {
Serial.begin (9600);
#define replay1 12
#define replay2 7
#define replay3 8
#define replay4 9
pinMode (replay1, OUTPUT);
digitalWrite (replay1, HIGH);
pinMode (replay2, OUTPUT);
digitalWrite (replay2, HIGH);
pinMode (replay3, OUTPUT);
digitalWrite (replay3, HIGH);
pinMode (replay4, OUTPUT);
digitalWrite (replay4, HIGH);

}
void loop () {
if (Serial.available ()> = 0) {
char c = Serial.read ();
Serial.println (c); // Test th? k? t? print out right
if (c == ‘1’) // value? click here to view lamp 1 s? light up, the other two lights?
{
digitalWrite (replay1, LOW);
delay (2000);
digitalWrite (replay1, HIGH);
digitalWrite (replay2, HIGH);
digitalWrite (replay3, HIGH);
digitalWrite (replay4, HIGH);
if (c == ‘2’) // value? Click on 2 lamp 2 s? light up, 2 lights
{
digitalWrite (replay1, HIGH);
digitalWrite (replay2, LOW);
delay (2000);
digitalWrite (replay2, HIGH);
digitalWrite (replay3, HIGH);
digitalWrite (replay4, HIGH);
}
if (c == ‘3’) // value? click on 3 lamp 3 s? light up, 2 lights
{
digitalWrite (replay1, HIGH);
digitalWrite (replay2, HIGH);
digitalWrite (replay3, LOW);
delay (2000);
digitalWrite (replay3, HIGH);
digitalWrite (replay4, HIGH);
}
if (c == ‘4’) ////? Click on the 4 th? 4 s lights? light up, 3 lights
{
digitalWrite (replay1, HIGH);
digitalWrite (replay2, HIGH);
digitalWrite (replay3, HIGH);
digitalWrite (replay4, LOW);
delay (2000);
digitalWrite (replay4, HIGH);
}
}
}

Here is your code formatted better and in code tags

void setup ()
{
  Serial.begin (9600);
#define replay1 12
#define replay2 7
#define replay3 8
#define replay4 9
  pinMode (replay1, OUTPUT);
  digitalWrite (replay1, HIGH);
  pinMode (replay2, OUTPUT);
  digitalWrite (replay2, HIGH);
  pinMode (replay3, OUTPUT);
  digitalWrite (replay3, HIGH);
  pinMode (replay4, OUTPUT);
  digitalWrite (replay4, HIGH);
}
void loop ()
{
  if (Serial.available () > = 0)
  {
    char c = Serial.read ();
    Serial.println (c); // Test th? k? t? print out right
    if (c == '1') // value? click here to view lamp 1 s? light up, the other two lights?
    {
      digitalWrite (replay1, LOW);
      delay (2000);
      digitalWrite (replay1, HIGH);
      digitalWrite (replay2, HIGH);
      digitalWrite (replay3, HIGH);
      digitalWrite (replay4, HIGH);
      if (c == '2') // value? Click on 2 lamp 2 s? light up, 2 lights
      {
        digitalWrite (replay1, HIGH);
        digitalWrite (replay2, LOW);
        delay (2000);
        digitalWrite (replay2, HIGH);
        digitalWrite (replay3, HIGH);
        digitalWrite (replay4, HIGH);
      }
      if (c == '3') // value? click on 3 lamp 3 s? light up, 2 lights
      {
        digitalWrite (replay1, HIGH);
        digitalWrite (replay2, HIGH);
        digitalWrite (replay3, LOW);
        delay (2000);
        digitalWrite (replay3, HIGH);
        digitalWrite (replay4, HIGH);
      }
      if (c == '4') ////? Click on the 4 th? 4 s lights? light up, 3 lights
      {
        digitalWrite (replay1, HIGH);
        digitalWrite (replay2, HIGH);
        digitalWrite (replay3, HIGH);
        digitalWrite (replay4, LOW);
        delay (2000);
        digitalWrite (replay4, HIGH);
      }
    }
  }

Which lines of code should be executed if c equals '1' ?

Why are the #defines in the setup() function and not at the start of the program ?

Please edit your post and use code tags

Type ``` [code] ``` before your code Type ``` [/code] ``` after your code

Further your code does not compile; you're missing a } at the end of the code (or elsewhere) and it's '>=' instead of '> =' (IDE 1.8.5).

What are #defines doing in setup? Although the compiler seems to be happy with it, they belong near the top of the code.

Instead of posting a screenshot, it would probably have been better if you would have posted a schematic how everything is connected (photo/scan of hand-drawn one is fine).

Next, from your code

void loop () {
  if (Serial.available () >= 0) {
    char c = Serial.read ();
    Serial.println (c); // Test th? k? t? print out right
    if (c == '1') // value? click here to view lamp 1 s? light up, the other two lights?
    {
      ...
      ...
      if (c == '2') // value? Click on 2 lamp 2 s? light up, 2 lights
      {
        ...
        ...
      }
      if (c == '3') // value? click on 3 lamp 3 s? light up, 2 lights
      {
        ...
        ...
      }
      if (c == '4') ////? Click on the 4 th? 4 s lights? light up, 3 lights
      {
        ...
        ...
      }
    }
  }
}

What do you think that the chances are that if c equals '1', it will also be equal to '2', '3' or whatever.