Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ header files example

//headers 
#ifndef TOOLS_hpp 
#define TOOLS_hpp
#include<vector> 
#include<iostream>
#include<fstream>
#include<string>
using std::ifstream;
using std::cout; 
using std::cin;
using std::endl;
using std::cerr;
using std::vector;
using std::string;
// functions prototypes 
inline vector<int> merge(const vector<int>&a,const vector<int>& b);//merge function prototype with Formal Parameters 
std::vector<int> sort(size_t start, size_t length, const std::vector<int>& vec);//sort function prototype with formal parameters 
#endif
Comment

c++ define function in header

#ifndef FUNCTIONS_H_INCLUDED
#define FUNCTIONS_H_INCLUDED

int add(int a, int b)
{
   return a + b;
}

#endif
Comment

how to declare a function in c++ header file

//somefile.h
#ifndef SOMEFILE_H
#define SOMEFILE_H
int add(int a, int b);
#endif
Comment

PREVIOUS NEXT
Code Example
Cpp :: how to write string in c++ 
Cpp :: Max / Min Stack in c++ using stl in O(1) time and space 
Cpp :: opengl triangle example 
Cpp :: c++ cout int 
Cpp :: assignment operator 
Cpp :: c++ how to get maximum value 
Cpp :: what does : mean in c++ 
Cpp :: palindrome no example 
Cpp :: deletion in bst 
Cpp :: add for input output file in c/c++ 
Cpp :: are arrays faster than vectors c++ 
Cpp :: Arduino Counting without Millis 
Cpp :: pointer to constant 
Cpp :: c++ pwstr to char* 
Cpp :: qt graphics scene map cursor position 
C :: pointer to a structure in c 
C :: boolean in c 
C :: how to use gets after scanf 
C :: react-textfit 
C :: Reduce fractions in C 
C :: malloc int array c 
C :: print ascii value in c 
C :: c language append line to file 
C :: c how to check a palindrome string 
C :: how to checkout branch from commit id 
C :: mongodb update 
C :: limit axis in one direction plt 
C :: c substring 
C :: number of hours, minutes, and seconds given the number of seconds. 
C :: why there is return 0 used in c 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =