0
Please what's wrong with this code.
#include <iostream> using namespace std; int main() { int a,b; cout << "please enter a number\n"; cin >> a; cout << "Enter another"; cin >> b; If(a > b) { cout << "The first number is greater than the second number"; } If(a < b) { cout << "The second number is greater than the first number"; } If(a == b) { cout << "The first number is equal to the second number"; } return 0; }
4 odpowiedzi
+ 1
Hi,
Seems like you used capitol I in the if keyword.
If you change all the I's it works like a charm.
int main()
{
    int a, b;
    cout << "please enter a number: ";
    cin >> a;
    cout << "Enter another: ";
    cin >> b;
    if(a > b) {
        cout << "The first number is greater than the second number";
    }
    if(a < b) {
        cout << "The second number is greater than the first number";
    }
    if(a == b) {
        cout << "The first number is equal to the second number";
    }
    return 0;
}
+ 1
Ove Sletta is right. Swap I for i and it works.
0
Thanks so much @ Sletta and  Marcin. 
I really appreciate your contribution. 
0
Its if not If



