Writing a function assistance

I'm working a hw assignment and was hoping someone could take a look at it and tell me if I'm on the right path before I submit it. Thanks

Write a function lessThan that returns a value of true when the counter object it's applied to has a smaller value than its counter argument.


This is what I have:

1
2
3
4
5
6
7
8
9
int lessThan (int a)
{
int x;
if (a
{
x=a;
return 1;
}
}
No. You're not on the right path.
I've looked into a little more, does this look any better? Thanks, if not can you give me an idea if its something specific or the entire thing is wrong

1
2
3
4
5
6
7
8
9
int lessThan (int a)
{
int x;
if (a<=x) return 2;
}
{
x<a;
return 1;
}


Write a function lessThan that returns a value of true when the counter object it's applied to has a smaller value than its counter argument.


Reread.

Where is "the counter object it's applied to" and where is its "counter argument?"
Topic archived. No new replies allowed.