|
-
April 13th, 2012, 07:08 PM
#1
[RESOLVED] Help writing code.
value Write a function, contains, that accepts an array of integers, the number of elements in the array and an integer value, and returns a boolean value indicating whether the value appears as an element of the array (arrays as parameters, basic search algorithm)
bool contains(int a[], int n, int val)
{
for(int i = 0; i < n; i++)
{
if(a[i] == val)
{
return = true;
}
}
}
what am i doing wrong..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|