Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ pre-processor instructions

//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

PREVIOUS NEXT
Code Example
Cpp :: c++ elif 
Cpp :: how to generate number in c++ 
Cpp :: c++ access second last element of vector 
Cpp :: c++ auto 
Cpp :: best time to buy and sell stock leetcode solution 
Cpp :: how to create 2d array using vector in c++ 
Cpp :: map in c 
Cpp :: how to use a non const function from a const function 
Cpp :: c++ client service ros 
Cpp :: Nested if...else 
Cpp :: inheritance example in C plus plus 
Cpp :: break statement in c++ program 
Cpp :: c++ for each loop 
Cpp :: c++ variable types 
Cpp :: c++ check if key exists in map 
Cpp :: uparam(ref) 
Cpp :: fstream read write mode 
Cpp :: cpp oop 
Cpp :: pop off end of string c++ 
Cpp :: how to fill vector from inputs c++ 
Cpp :: ImGui button wit picture 
Cpp :: bit++ codeforces in c++ 
Cpp :: Program to print full pyramid using 
Cpp :: c++ define array with values 
Cpp :: c++ class methods 
Cpp :: c++ function pointer as variable 
Cpp :: heap allocated array in c ++ 
Cpp :: how to set arrays as function parameters in c++ 
Cpp :: vector of vectors c++ 
Cpp :: fname from FString 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =