hi all,
i cannot success the program
[Linker error] undefined reference to `WinMain@16'
ld returned 1 exit status
// Program 6.5
#include <iostream>
using namespace std;
int CarianPduaan (int a[ ], int n, int target)
{ int first=0;
int last=n-1;
int mid;
while (first <= last)
{ mid = (first + last) /2;
if(target== a[mid])
return mid;
else if(target< a[mid])
{
last=mid -1;
cout<<"nilai tengah:"<<mid<<"\tmula:"<<first<<"\takhir:"<<last<<endl;
}
else
{
first=mid +1;
cout<<"nilai tengah:"<<mid<<"\tmula:"<<first<<"\takhir:"<<last<<endl;
}
}
return -1;
}
can you give me an example?