Results 1 to 5 of 5

Thread: Ruh?

  1. #1
    Guest
    What is a header exactly? you knwo the thing that has to be included with C++ program if you want to do some certain stuff... like ---> <iostream.h> <--- is it a c++ function? or is it a class?

    Thanks.






  2. #2
    Guest
    A header file just contains pre-written code. The header file "iostream.h" contains the "cout" function. "string.h" contains "strlen()", and so on...

  3. #3
    Guest

    Talking OOok thanks.


  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Actually, headers contain definitions, rather than actual code. You then include the header and link with the library, which contains the actual code. The header is just there for the compiler's benefit so it knows what you're doing.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    You could make your own header file called mymaths.h that could include functions for adding and subtracting 2 numbers . Like:

    int Add(int nNumber1, int nNumber2)
    {
    return nNumber1 + nNumber2;
    }

    Then for a console app you could put:

    #include "mymaths.h"
    #include "iostream.h"

    void main()
    {
    char cPause;
    int nAnswer;
    nAnswer = Add(34,65);
    cout << nAnswer;
    cin >> cPause;
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width