Integer comparison: Difference between revisions
Content added Content deleted
(→{{header|Korn Shell}}: Corrected example (the old version had the same semantic, but didn't meet the task's requirements)) |
m (→{{header|C++}}) |
||
Line 111: | Line 111: | ||
=={{header|C++}}== |
=={{header|C++}}== |
||
#include <iostream> |
#include <iostream> |
||
#include <istream> |
|||
#include <ostream> |
|||
int main() |
int main() |
||
Line 121: | Line 119: | ||
// test for less-than |
// test for less-than |
||
if (a < b) |
if (a < b) |
||
std::cout << a << " is less than " << b << |
std::cout << a << " is less than " << b << std::endl; |
||
// test for equality |
// test for equality |
||
if (a == b) |
if (a == b) |
||
std::cout << a << " is equal to " << b << |
std::cout << a << " is equal to " << b << std::endl; |
||
// test for greater-than |
// test for greater-than |
||
if (a > b) |
if (a > b) |
||
std::cout << a << " is greater than " << b << |
std::cout << a << " is greater than " << b << std::endl; |
||
return 0; |
return 0; |