The program is simply designed to tell the difference between the two integers. Heres what I've entered.
CODE
// Practice 1A.cpp : Defines the entry point for the console application.
//
/* Simple Addition Program */
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
int num1; /* first number user inputs */
int num2; /* second number user inputs */
printf( "Enter two numbers, and I will tell you\n" );
printf( "the relationships they satisfy: " );
scanf( "%d%d", &num1, &num2 ); /* read two integers */
if (num1 == num2) {
printf( "%d is equal to %d\n" , num1, num2 );
} /* If numbers equal each other, print this */
if (num1 != num2) {
printf( "%d is not equal to %d\n" , num1, num2 );
} /* If numbers do not equal each other print this */
if (num1 < num2) {
printf( "%d is less than %d\n" , num1, num2 );
} /* If num1 is less than num2 print this */
if (num1 > num2) {
printf( "%d is more than %d\n" , num1, num2 );
/* If num1 is more than num2 print this */
}
if (num1 <= num2) {
printf( "%d is less than or equal to %d\n");
/* If num1 is less than or equal to num2 print this */
}
if (num1 >= num2) {
printf( "%d is greater than or equal to %d\n");
/* If num1 is greater than or equal to num2 print this */
}
return 0;
}
Here is what the printout looks like, lets say the user has entered 5 and 6.
Enter two numbers, and I will tell you
the relationship they satisfy: 5 6
5 is not equal to 6
5 is less than 6
0 is less than or equal to 0
Press any key to continue . . .
If someone could kindly tell me why "0 is less than or equal to 0" comes up, I would appreciate it a lot. Until then, I'll keep retrying.
Thank you.
Adot2the~