Operators Statements C++ Tutorial

#include  
#include  
using namespace std; 
 
int main() 

  int magic; 
  int guess;
 
  magic = rand(); // get a random number 
   
  do { 
    cout << "Enter your guess: "; 
    cin >> guess; 
    if(guess == magic) { 
      cout << "Right"; 
      cout << magic << " is the magic number.\n"; 
    } 
    else { 
      cout << "...Sorry, you're wrong."; 
      if(guess > magic) 
         cout << " Your guess is too high.\n"; 
      else cout << " Your guess is too low.\n"; 
    } 
  } while(guess != magic); 
 
  return 0; 
}
Enter your guess: 3
...Sorry, you're wrong. Your guess is too low.
Enter your guess: 2
...Sorry, you're wrong. Your guess is too low.
Enter your guess: 3
...Sorry, you're wrong. Your guess is too low.
Enter your guess: 4
...Sorry, you're wrong. Your guess is too low.
Enter your guess: 7
...Sorry, you're wrong. Your guess is too low.
Enter your guess: 8
...Sorry, you're wrong. Your guess is too low.
Enter your guess: 12
...Sorry, you're wrong. Your guess is too low.
Enter your guess: 30
...Sorry, you're wrong. Your guess is too low.
Enter your guess: 500
...Sorry, you're wrong. Your guess is too high.
Enter your guess: 250
...Sorry, you're wrong. Your guess is too high.
Enter your guess: 125
...Sorry, you're wrong. Your guess is too high.
Enter your guess: 60
...Sorry, you're wrong. Your guess is too high.
Enter your guess: 30
...Sorry, you're wrong. Your guess is too low.
Enter your guess: 45
...Sorry, you're wrong. Your guess is too high.
Enter your guess: 40
...Sorry, you're wrong. Your guess is too low.
Enter your guess: 43
...Sorry, you're wrong. Your guess is too high.
Enter your guess: 42
...Sorry, you're wrong. Your guess is too high.
Enter your guess: 41
Right41 is the magic number.