7 line display + buttons

Hello everyone!
I have a problem with a 7 line display.I have an Arduino Uno R3.
Firstly,I had connected the 7 line display to Arduino and uploaded this code :

int A = 7;   //Defines all pins on the Arduino Uno board in order of connection.
int B = 6;
int C = 4;  // DOT is pin 5, not used in this example.
int D = 3;
int E = 2;
int F = 8;
int G = 9;
byte num0 = 0x3F;  
byte num1 = 0x6;
byte num2 = 0x5B;
byte num3 = 0x4F;
byte num4 = 0x66;
byte num5 = 0x6D;
byte num6 = 0x7C;
byte num7 = 0x7;
byte num8 = 0x7F;
byte num9 = 0x6F;
void on(byte num)   // This function turns on the correct pins to display numbers passed to it         // through the variable "num".
{
  int result = bitRead(num, 0);  // Read the first binary entry in num and stores it in result.
      if (result == 1)  // Check to see if this segment should be on.
    {digitalWrite(A, HIGH);}   // Turns on the segment.
    else   // Otherwise, it turns it off.
    {digitalWrite(A, LOW);}  // Turns segment off.
      result = bitRead( num, 1);  // Same thing for the 6 remaining segments.
      if (result == 1)
    {digitalWrite(B, HIGH);}
    else
    {digitalWrite(B, LOW);}     
    result = bitRead( num, 2);
      if (result == 1)
    {digitalWrite(C, HIGH);}
    else
    {digitalWrite(C, LOW);}    
   result = bitRead( num, 3);
      if (result == 1)
    {digitalWrite(D, HIGH);}
    else
    {digitalWrite(D, LOW);}    
   result = bitRead( num, 4);
      if (result == 1)
    {digitalWrite(E, HIGH);}
    else
    {digitalWrite(E, LOW);}
    
   result = bitRead( num, 5);  
      if (result == 1)
    {digitalWrite(F, HIGH);}
    else
    {digitalWrite(F, LOW);}    
    
   result = bitRead( num, 6);
      if (result == 1)
    {digitalWrite(G, HIGH);}
    else
    {digitalWrite(G, LOW);}
  }
void setup() {       // Our setup routine         
  pinMode(A, OUTPUT); // Making all pins outputs
  pinMode(B, OUTPUT);
  pinMode(C, OUTPUT);
  pinMode(D, OUTPUT);
  pinMode(E, OUTPUT);
  pinMode(F, OUTPUT);
  pinMode(G, OUTPUT);
  pinMode(10,OUTPUT);
}
void loop() {   // Loops forever
  on(num0);   // Passing "num0" to the function  "on()" defined above to display "0"
 delay(500);   // Delay for 1 second to see the "0"
  on(num1);  // Change to "1"
  delay(500); 
  on(num2);  
  delay(500);
  on(num3);  
  delay(500);
  on(num4);  
  delay(500);
  on(num5);  
  delay(500);
  on(num6);  
  delay(500);
  on(num7);
  delay(500);
  on(num8);  
  delay(500);  
  on(num9);  
  delay(500);
}

and it was working. Then i wanted to tweak my project and to add buttons.So,here's the problem:I've connected
the buttons to arduino (the pins with i connected the arduino you'll see in the next code)
and i uploaded the code :

int A = 7;   //Defines all pins on the Arduino Uno board in order of connection.
int B = 6;
int C = 4;  // DOT is pin 5, not used in this example.
int D = 3;
int E = 2;
int F = 8;
int G = 9;
int button1 = 10;
int button2 = 11;
int button3 = 12;
int button4 = 13;
int bstate1 = 0;
int bstate2 = 0;
int bstate3 = 0;
int bstate4 = 0;
byte num0 = 0x3F;  //Hexadecimal format based upon the A-G, 0-9 Chart in excel and the wiring      // of the segment (refer to the on/off table image below).
byte num1 = 0x6;
byte num2 = 0x5B;
byte num3 = 0x4F;
byte num4 = 0x66;
byte num5 = 0x6D;
byte num6 = 0x7C;
byte num7 = 0x7;
byte num8 = 0x7F;
byte num9 = 0x6F;
void on(byte num)   // This function turns on the correct pins to display numbers passed to it         // through the variable "num".
{
  int result = bitRead(num, 0);  // Read the first binary entry in num and stores it in result.
      if (result == 1)  // Check to see if this segment should be on.
    {digitalWrite(A, HIGH);}   // Turns on the segment.
    else   // Otherwise, it turns it off.
    {digitalWrite(A, LOW);}  // Turns segment off.
      result = bitRead( num, 1);  // Same thing for the 6 remaining segments.
      if (result == 1)
    {digitalWrite(B, HIGH);}
    else
    {digitalWrite(B, LOW);}     
    result = bitRead( num, 2);
      if (result == 1)
    {digitalWrite(C, HIGH);}
    else
    {digitalWrite(C, LOW);}    
   result = bitRead( num, 3);
      if (result == 1)
    {digitalWrite(D, HIGH);}
    else
    {digitalWrite(D, LOW);}    
   result = bitRead( num, 4);
      if (result == 1)
    {digitalWrite(E, HIGH);}
    else
    {digitalWrite(E, LOW);}
    
   result = bitRead( num, 5);  
      if (result == 1)
    {digitalWrite(F, HIGH);}
    else
    {digitalWrite(F, LOW);}    
    
   result = bitRead( num, 6);
      if (result == 1)
    {digitalWrite(G, HIGH);}
    else
    {digitalWrite(G, LOW);}
  }
void setup() {       // Our setup routine         
  pinMode(A, OUTPUT); // Making all pins outputs
  pinMode(B, OUTPUT);
  pinMode(C, OUTPUT);
  pinMode(D, OUTPUT);
  pinMode(E, OUTPUT);
  pinMode(F, OUTPUT);
  pinMode(G, OUTPUT);
  pinMode(10,OUTPUT);
  pinMode(button1, INPUT);
  pinMode(button2, INPUT);
  pinMode(button3, INPUT);
  pinMode(button4, INPUT);
}
void loop() {   // Loops forever
  int bstate1 = digitalRead(button1);
  int bstate2 = digitalRead(button2);
  int bstate3 = digitalRead(button3);
  int bstate4 = digitalRead(button4);
  on(num0);
  if(bstate1 == HIGH) {
    on(num1);
  }
  else {
    on(num0);
  }
  if(bstate2 == HIGH)  {
    on(num2);
  }
  else {
    on(num0);
  }
  if (bstate3 == HIGH) {
    on(num3);
  }
  else {
    on(num0);
  }
  if (bstate4 == HIGH) {
    on(num4);
  }
  else { 
    on(num0);
  }
  if (bstate1 == HIGH && bstate2 == HIGH) {
    on(num5);
  }
  else {
    on(num0);
  }
  if (bstate1 == HIGH && bstate3 == HIGH) {
    on(num6);
  }
  else { 
    on(num0);
  }
  if (bstate1 == HIGH && bstate4 == HIGH) {
    on(num7);
  }
  else {
    on(num0);
  }
  if (bstate2 == HIGH && bstate3 == HIGH) {
    on(num8);
  }
  else {
     on(num0);
  }
  if (bstate3 == HIGH && bstate4 == HIGH) {
    on(num9);
  }
  else {
    on(num0);
  }
}

And it wasn't working.What was i doing wrong?Is it correct if i use all the buttons?
Can i use only one button?And what will be the code if i use only one button?

Sorry for my bad english(I'm still 13 and in my country nobody speaks english) and sorry for my bad knowledge in arduino.

Your on function can be greatly simplified if you use an array for your LED pins and a FOR loop to cycle through them and the num bits.

Small example.

const byte myPins[7] = {7,6,4,3,2,8,9};

. . .

void setup()
{
  for(byte idx = 0; idx < 7; idx++)
  {
     pinMode(myPins[idx], OUTPUT); // sets arduino pins as outputs
     digitalWrite(myPins[idx], LOW); // makes sure all LEDs are off
  }
}

. . .

void on(byte num)   // This function turns on the correct pins to display numbers passed to it         // through the variable "num".
{
  for(byte idx = 0; idx < 7; idx++)
  {
     digitalWrite(myPins[idx], num & (1 << idx) );
  }
}

Another thing you can do, is use an array for your numX values. This way if you enter 1 in the serial monitor or keypad, the corresponding num value will be sent into the on function. Its the same as I did with your LED pins but this time it will be your num values. Note if you are using the serial monitor or keypad, you will need to subtract the character zero ‘0’ from the value returned by Serial.read(). (myVal = Serial.read() - ‘0’; )

#HazardsMind ,

Sure,but my point is to turn on the 7 line display number after the button is pressed,for example, if i press the button,the num1 appears on display,if i press the button again,num2 appears on the 7 line display...

Ok, that is a simple counter.
This sketch uses two buttons, but you can change it to use just one and reset to zero when it reaches the max value.

const byte ButtonOne = 2;
const byte ButtonTwo = 3;

byte ButtonStateOne, ButtonStateTwo;

byte lastS_One = LOW, lastS_Two = LOW;
byte count = 0, MinRange = 0, MaxRange = 10;

void setup() 
{
  Serial.begin(115200);
  pinMode(ButtonOne, INPUT);
  pinMode(ButtonTwo, INPUT);
}

void loop() {
  ButtonStateOne = digitalRead(ButtonOne);
  ButtonStateTwo = digitalRead(ButtonTwo);

  if (ButtonStateOne != lastS_One) // Up
  {
    if (ButtonStateOne == HIGH)
    {
      if (count < MaxRange)
      {
        count++; // same as count = count + 1;
      }
      else count = MaxRange;
      Serial.println(count);
    }
    lastS_One = ButtonStateOne;
  }

  if (ButtonStateTwo != lastS_Two) // Down
  {
    if (ButtonStateTwo == HIGH )
    {
      if (count > MinRange)
      {
        count--; // same as count = count - 1;
      }
      else count = MinRange;
      Serial.println(count);
    }
    lastS_Two = ButtonStateTwo;
  }
}