This code you are asked to input a number and it will tell u wheter or not the input you entered is in the array or not
i am having issues with this code and its giving me some errors,
if anyone wants to help me out it will be greatly appreciated!

include <iostream>
using namespace std;

int search(int a[], int size, int searchKey);

int main()
{
  int small, a[]= {10, 15, 27, 89, 90, 95, 27, 13, 99, 33};
  const int size = 10;
  int i;
  int target;
  int searchKey;

  cout << "Enter a number to be found: ";
  cin >> target;

  if(a[i] == target)
    cout <<"Number found" ;
  else
    cout <<"Number not found in the array" << endl;

  return 0;

  int search(int a[], int size, int searchKey)
  {
    {
      int i;
      int target;
      for(a[i] = 0; i < size; i++)
        {
          if(a[i] == target)
            return i;
        }
          else return 0;
    }
  }

This code you are asked to input a number and it will tell u wheter or not the input you entered is in the array or not
i am having issues with this code and its giving me some errors,
if anyone wants to help me out it will be greatly appreciated!

Stop posting your questions as Code Snippets.
When you ask a question, give details! "Having issues" does not give us any information. Explain your problems and give us an idea where the problem is.

You've omitted and mismatched. You don't even call your function. At least try to get it to compile before you post--and if after that you have a "unbeatable" error, at least let us know what it is.

Hi,

Here is a simpler way for your program.

#include <iostream>
#include <algorithm>

using namespace std;

int main(){
	const int size = 10;
	int num = 0;
	int a[]= {10, 15, 27, 89, 90, 95, 27, 13, 99, 33};
	cout<<"Enter the number you are looking for ";
	cin>>num;
	sort(a, a + size);
	if(binary_search(a, a + 10, num)){
		cout<<"Number Found"<<endl;
		return 0;
	}
	cout<<"Number not found"<<endl;
	return 0;
}

Varun

commented: Do not do homework for others. You don't get the grade and they don't deserve it. -2

Unfortunately, when people are taking a course instructors often put things like the STL off limits (which provides for some great opportunities to reinvent the reinvented wheel). Also, giving the OP a solution in a can doesn't do much to help their learning process.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.