Possible Function?

Apr 26, 2011 at 9:45pm
Uhm... I'm at a loss... I can't find it in the tutorial, so maybe it doesn't exist, but is there a function that can do something like this:

if (variable 1 is +5 or higher than variable 2)

I am a little bonkers when I wrote this, and thus I may have forgotten the tutorial answer.
Last edited on Apr 26, 2011 at 9:48pm
Apr 26, 2011 at 9:48pm

if (x == 5 + y || x > 5 + y)? I'm guessing, try it out.
Apr 26, 2011 at 9:52pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
using namespace std;
int main()
{
int x, y = 5;
cin >> x;
if (x >= 5 + y) //|| x > 5 + y)
{
	cout << x << " is bigger than or equal to" << y << " + 5";

}
else
{
cout << " stfu";
}
return 0;
}

This actually may be what you wanted to get. So there is two answers, use this example because it is faster and better.
Apr 26, 2011 at 9:54pm
Thanks LittleQuick, you made me think of it.
if (x > (y+5))

I think this is it, at least xD
Apr 26, 2011 at 10:16pm
Yours is completely right xD I'm just a little confused.
Topic archived. No new replies allowed.