greater than 100

i used if statements and i would like to know is there any other way to create a program that finds value greater than 100.


#include <iostream>

using namespace std;

int main()
{
int x;
cout<<"Enter an integer: "<<endl;
cin>> x;

if (x>100)
{
cout << x << " is greater than 100." << endl;
}
else
{
cout << x << " is less than 100." << endl;
}
return 0;
}
Sure there is. But this one is simple enough. But what's the point of this question?

Also, my advice would be to contain all your code in [.code][./code] tags, without dots('.'). It will convert your code to C++ code, like this:
1
2
3
4
5
int main()
{
   std::cout << "Hello, I'm C++ code!" << std::endl;
   return 0;
}


It's simpler to read. :)

Cheers!
Topic archived. No new replies allowed.