How to create a new header file in c++ and how to input functions into it.
please tell this in a detailed manner.
i will be obliged to you.
Thank you!
please tell this in a detailed manner.
i will be obliged to you.
Thank you!
/* mycode.c */ #include<afile>
/* mycode.c */ #include"afile.h"
/* mycode.c */ #include<afile.h>
#ifndef __MYHEADER__ #define __MYHEADER__ // includes #include <iostream> #include <string> #include <map> // any user define types ie: typedef std::map<std::string, std::string> tdm; // any function prototypes void foo(const std::string &); #endif
#include "myheader.h"
int main() {
foo("test");
std::cin.get();
}
#include "myheader.h"
void foo(const std::string &str) {
std::cout << str << std::endl;
}
#include<"afile .h"> would be a typo and should be #include"afile. h".#include<afile. h> the preprocessor searches for a sequence of implementation defined places.#include"afile. h" the preprocessor searches in an implementation defined manor and if that fails it treats it as if it had been #include"afile. h".#include"afile. h" then afile.h must be in the same directory as afile.cpp/afile.c
Comment