Writing a function assistance
Dec 1, 2012 at 3:40am UTC
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;
}
}
Dec 1, 2012 at 3:51am UTC
No. You're not on the right path.
Dec 1, 2012 at 4:33am UTC
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;
}
Dec 1, 2012 at 4:49am UTC
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.