A few questions about custom headers

I had a few quick questions about the following:
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Includes the headers we need.
#include <iostream>
#include <windows.h>
#include <string>
#include "functions.h"

// Declare functions
void play();
void core_switch(char response);

// Main function
int main() {
// Here is where you can call all of your functions.
// This include function calls to the external file.
}

functions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>
#include <windows.h>
#include <string>

/*
    C++ Generic Functions
    Written By: Joyel Puryear (www.infotechnologist.biz)
    - This is a collection of functions that handle generic tasks to make
    C++ programming easier.
*/

/*
    Function: Fullscreen
    Description: Switches the user to Fullscreen
    Requires: windows.h
*/
void FullScreen()
{
	keybd_event(VK_MENU,
                0x38,
                0,
                0);
    keybd_event(VK_RETURN,
                0x1c,
                0,
                0);
    keybd_event(VK_RETURN,
                0x1c,
                KEYEVENTF_KEYUP,
                0);
    keybd_event(VK_MENU,
                0x38,
                KEYEVENTF_KEYUP,
                0);
}

/*
    Function: centerstring
    Description: Centers text in the user's screen
    Requires: windows.h
*/
void centerstring(char* s) {
    // Get the length of the variable
    int l=strlen(s);
    // Get the current position
    int pos=(int)((80-l)/2);
    // Setup enough padding to make it centered
    for(int i=0;i<pos;i++) {
        std::cout<<" ";
    }
    // send out the variable as well as an endline
    std::cout<<s<<std::endl;
}


Questions:
1) Do I have to include the require headers (like string, iostream, and/or windows.h) inside both my function file, as well as the main.cpp file? Or can I just call them all inside my .h file and then they would be available inside the main.cpp as well?

2) Why doesn't this file get included properly...it's returning an error about invalid filetype, or cannot find file or something?

3) If these functions are inside the function file..do I still have to pre-create them before the main function in main.cpp or are they already available from the other file?
1) Yes, I answered this myself because I finally got the file included.
2) Yes, I created it wrong the first time and corrupted it, I recreated it and it works fine.
3) Nope, I just tested this myself. Sorry for this unneeded post.
Topic archived. No new replies allowed.