Game Development Reference
In-Depth Information
Listing 3-8. The Greater-Than Operator
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
cout << "Enter your first number: " << endl;
int number1 = 0;
cin >> number1;
cout << "Enter your second number: " << endl;
int number2 = 0;
cin >> number2;
bool result = number1 > number2;
cout << "It is "
<< result
<< " that your first number is greater than your second."
<< endl;
return 0;
}
Listing 3-9 shows a use of the greater-than or equal to operator.
Listing 3-9. The Greater-Than or Equal To Operator
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
cout << "Enter your first number: " << endl;
int number1 = 0;
cin >> number1;
cout << "Enter your second number: " << endl;
int number2 = 0;
cin >> number2;
bool result = number1 >= number2;
cout << "It is "
<< result
<< " that your first number is greater than"
<< " or equal to your second."
<< endl;
return 0;
}
 
Search WWH ::




Custom Search