making a .h file

This is a discussion on making a .h file within the C++ Programming forums, part of the General Programming Boards category; All right guys here is my code now if I wont to use this as an include.h file what do ...

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    43

    making a .h file

    All right guys here is my code now if I wont to use this as an include.h file what do I need to change and why?

    Code:
    int main()
    {
     int x, y;
      mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
      Sleep(rand(20)%15);
      mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
    }
    Iím Dyslexic and I know that I donít spell well so quit telling to learn my English because I do my best at it all right.

    Windows XP with Dev-C++ for now.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,827
    You would need to place the body of main() in a function. The function prototype would go in the header, then the implementation in the source file. main() would then just call the function.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    43
    sorry stupid qustion

    thaks for the answer above thow
    Last edited by JordanCason; 11-29-2007 at 09:14 PM.
    Iím Dyslexic and I know that I donít spell well so quit telling to learn my English because I do my best at it all right.

    Windows XP with Dev-C++ for now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  2. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 04:02 AM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21