Game Development Reference
In-Depth Information
Listing 3-10 shows an example of the less-than operator.
Listing 3-10. The Less 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 less than your second."
<< endl;
return 0;
}
Finally, Listing 3-11 shows a use of the less-than or equal to operator.
Listing 3-11. The Less-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 less than "
 
Search WWH ::




Custom Search