Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Help with C++


ghost's Avatar
0 0

Hello all, I am using Dev C++ as a compiler and would like to know how to call a function when any button on the mouse is pressed. Thanks for your help. ~ Nick.


ghost's Avatar
0 0

BUMP!!!


ghost's Avatar
0 0

Its amazing what happens when people use google aint it… Took me 5 seconds to google this… people need to stop being lazy.

#include <stdio.h>
void my_int_func(int x)
{
    printf( "%d\n", x );
}


int main()
{
    void (*foo)(int);
    foo = &my_int_func;

    /* call my_int_func (note that you do not need to write (*foo)(2) ) */
    foo( 2 );
    /* but if you want to, you may */
    (*foo)( 2 );

    return 0;
}

I got this from === http://www.cprogramming.com/tutorial/function-pointers.html

That whole page is about functions in C++ for the mouse.

Next time DONT BE LAZY and get off your arse.

That and don't bump a thread becasue no one is answering you, they most likely aren't answering you because you are too freaking lazy to look it up yourself.


ghost's Avatar
0 0

Also, if you have read the first few lessons in C++ you will know the getch(); function.

=/