#include <iostream>
#include <cstdlib>
using namespace std;
const int arrSize = 100;
bool isPresent(int ,int );
int main()
{
int myArr[arrSize];
int input;
for (int i=0; i<=arrSize; i++)
myArr[i]=rand()%200; //creating array with random numbers
//sorting random numbers
for (int j=0; j<=arrSize; j++){
for(int k=0; k<j ; k++){
if (myArr[j] < myArr[k]){
myArr[k] = myArr[j] + myArr[k];
myArr[j] = myArr[k] - myArr[j];
myArr[k] = myArr[k] - myArr[j];
}
}
}
char quit;
while ( (quit!='N') || (quit!='n') )
{
cout<<"\n Enter number to check in the array: \n";
cin>>input;
bool j= isPresent( myArr[arrSize], input );
if ( j )
cout<<"\n End "<<endl;
cout<<" Do you want to check for another number?\n";
cin>>quit;
}
system("PAUSE");
return 0;
}
bool isPresent(int theArr[arrSize], int n)
{
float x=arrSize;
for (int j=0; j<=arrSize; j++)
{
[B][I] if ( (x%2)== 1 );
{x=x+1;}
if (n==theArr[x/2])
{ cout<<"Element found at location "<<x/2<<endl;
return 0;}
else;{
if (n<=theArr[x/2])
x=x/2;
if(n>=theArr[x/2])
x=1.75*x; }[/I][/B]
}
cout<<"\n Not found"<<endl;
return 1;
}
// code is the intellectual property of 09030032 [at] lums.edu.pk
why are the bold/italisized "ifs" giving me an error when compiling?