Search
 
SCRIPT & CODE EXAMPLE
 

CPP

cpp define

//INCLUDING BUILT-IN LIBRARIES...
#include <iostream>
#include <stdlib.h>
//PRE-DEFINE CONSTANT VALUES...
#define MAXNUM -12    //defining an integer
#define PI 3.1415     //defining a float
#define END "

		Program has ended!!
"   //defining a string
//PRE-DEFINING CONSTANT OPERATIONS...
#define ADD(a, b, c) (a + b + c)    //Operation that will add its 3 parameters

using namespace std;

int main(){
    //using other definitions to check if the current device is Windows or UNIX
    #ifdef _WIN32  
        cout<<"Windows Operating System Detected"<<endl;
    #elif __unix__
        cout<<"UNIX Operating System Detected"<<endl;
    #else
        cout<<"Operating System could NOT be identified!"<<endl;
    #endif
    
    cout<<endl<<"Using pre-defined values and operations: "<<endl;
    cout<<" • MAXNUM: "<<MAXNUM<<endl;       //using pre-defined integer
    cout<<" • PI: "<<PI<<endl;               //using pre-defined float
    cout<<" • ADD(): "<<ADD(2,5,99.5)<<endl;   //using pre-defined function

    cout<<END;    //using pre-defined string
    return 0;
}
Comment

define in cpp

#include <iostream> 
  
// macro definition 
#define LIMIT 5 

int main() 
{ 
    for (int i = 0; i < LIMIT; i++) { 
        std::cout << i << "
"; 
    } 
  
    return 0; 
} 
Comment

define c++

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ar array
#define ll long long
#define pb push_back
Comment

#define in cpp

// The #define preprocessor directive creates symbolic constants
#include <iostream>
using namespace std;

#define CONSTANT 2.71828

int main () {
   cout << "Declared constant: " << CONSTANT << endl; 

   return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: how to make window resizable in sdl 
Cpp :: factorial in c++ using recursion 
Cpp :: size of a matrix using vector c++ 
Cpp :: transformer in nlp 
Cpp :: c++ range based for loop 
Cpp :: c++ pointers and functions 
Cpp :: strring length in c++ 
Cpp :: initialize vector 
Cpp :: reverse an array in c++ stl 
Cpp :: inheritance in c++ 
Cpp :: how to initialize a queue in c 
Cpp :: c++ math 
Cpp :: overload subscript operator cpp 
Cpp :: comparator priority queue c++ 
Cpp :: c++ template vs code 
Cpp :: find text in string c++ true false 
Cpp :: Integer Moves codeforces solution 
Cpp :: c++ convert int to cstring 
Cpp :: how to write int variable c++ 
Cpp :: balanced parentheses 
Cpp :: stoi in c++ 
Cpp :: vectors in c++ 
Cpp :: integer max value c++ 
Cpp :: c++ awitch statements 
Cpp :: c++ check if number is even or odd 
Cpp :: c++ create function pointer 
Cpp :: tr bash 
Cpp :: print all subsequences 
Cpp :: cpp compare strings 
Cpp :: lcm in c++ 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =