Click here to Skip to main content
16,010,488 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Easy question about passing by refrence to another function Pin
AlexO7-Jul-03 8:22
AlexO7-Jul-03 8:22 
GeneralRe: Easy question about passing by refrence to another function Pin
johnstonsk7-Jul-03 8:33
johnstonsk7-Jul-03 8:33 
GeneralRe: Easy question about passing by refrence to another function Pin
AlexO7-Jul-03 8:44
AlexO7-Jul-03 8:44 
GeneralDeleting an application that is currently loaded Pin
Dangleberry7-Jul-03 7:47
sussDangleberry7-Jul-03 7:47 
GeneralRe: Deleting an application that is currently loaded Pin
John M. Drescher7-Jul-03 8:05
John M. Drescher7-Jul-03 8:05 
GeneralRe: Deleting an application that is currently loaded Pin
Dangleberry7-Jul-03 8:28
sussDangleberry7-Jul-03 8:28 
GeneralRe: Deleting an application that is currently loaded Pin
Dudi Avramov7-Jul-03 22:10
Dudi Avramov7-Jul-03 22:10 
Generaluse of double type Pin
DaveE9th7-Jul-03 7:45
DaveE9th7-Jul-03 7:45 
I'm working with "bsearch", a binary sort program. I am experimenting a bit for the sake of learning. I have replaced all of the "int" prototypes with "double" to enable decimals. For some reason I get the follwing error message when I compile. I'm sure it's a simple mistake, but I can't find it.

Compiling...
jjjmn.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\Exodus\jjjmn.cpp(20) : error C2664: 'bsearch' : cannot convert parameter 5 from 'double (const void *,const void *)' to 'int (__cdecl *)(const void *,const void *)'
None of the functions with this name in scope match the target type
Error executing cl.exe.

pppp.exe - 1 error(s), 0 warning(s)

below is the program...
----------------------------------------------------
/* bsearch example */
#include <stdio.h>
#include <stdlib.h>
#include <iostream>

using namespace std;
double values[] = { 10.1, 20.4, 25.6, 40.3, 90.7, 100.4 };
double compare (const void * a, const void * b)
{
return ( *(double*)a - *(double*)b );
}

double main ()
{
double * pItem;
double x;
cout<<"enter your number when ready.";
cin>>x;
double key = x;
pItem = (double*) bsearch (&key, values, 6, sizeof (double), compare);
if (pItem!=NULL)
printf ("%d is in the array",*pItem);
else
printf ("%d is not in the array",key);
return 0.0;
}

-------------------------------------------------------
thanks

VC++ 6.0
GeneralRe: use of double type Pin
cmk7-Jul-03 8:09
cmk7-Jul-03 8:09 
GeneralRe: use of double type Pin
DaveE9th7-Jul-03 22:47
DaveE9th7-Jul-03 22:47 
GeneralRe: use of double type Pin
David Crow8-Jul-03 3:25
David Crow8-Jul-03 3:25 
GeneralNetwork question Pin
VitSoft7-Jul-03 7:02
VitSoft7-Jul-03 7:02 
GeneralFree static (dll) libary Pin
AnTri7-Jul-03 6:22
AnTri7-Jul-03 6:22 
GeneralRe: Free static (dll) libary Pin
David Crow7-Jul-03 7:19
David Crow7-Jul-03 7:19 
GeneralRe: Free static (dll) libary Pin
AnTri7-Jul-03 8:38
AnTri7-Jul-03 8:38 
GeneralRe: Free static (dll) libary Pin
David Crow7-Jul-03 10:12
David Crow7-Jul-03 10:12 
GeneralRe: Free static (dll) libary Pin
Navin7-Jul-03 9:55
Navin7-Jul-03 9:55 
Questionhow to write memory of a other process Pin
rriemann7-Jul-03 5:38
rriemann7-Jul-03 5:38 
AnswerRe: how to write memory of a other process Pin
basementman7-Jul-03 6:03
basementman7-Jul-03 6:03 
AnswerRe: how to write memory of a other process Pin
User 66587-Jul-03 6:26
User 66587-Jul-03 6:26 
GeneralRe: how to write memory of a other process Pin
rriemann7-Jul-03 6:56
rriemann7-Jul-03 6:56 
Generalaudio wave compression Pin
will13837-Jul-03 5:13
will13837-Jul-03 5:13 
GeneralQuestion about the font in PDF Pin
Bosicat7-Jul-03 4:48
Bosicat7-Jul-03 4:48 
GeneralRe: Question about the font in PDF Pin
John M. Drescher7-Jul-03 12:59
John M. Drescher7-Jul-03 12:59 
GeneralRe: Question about the font in PDF Pin
J. Dunlap7-Jul-03 13:10
J. Dunlap7-Jul-03 13:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.