Search
 
SCRIPT & CODE EXAMPLE
 

CPP

cpp ifdef

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

iff cpp

bool state = (value > 0) ? true : false;
Comment

PREVIOUS NEXT
Code Example
Cpp :: pointer cpp 
Cpp :: SUMOFPROD2 
Cpp :: std::count() in C++ STL 
Cpp :: cpp auto 
Cpp :: create matrix cpp 
Cpp :: find substring in string c++ 
Cpp :: cpp #include "" < 
Cpp :: swap in cpp 
Cpp :: c++ set swap 
Cpp :: stl function to reverse an array 
Cpp :: c ++ split_string 
Cpp :: lambda function in c++ 
Cpp :: exception handling class c++ 
Cpp :: linked list cycle c++ 
Cpp :: Bucket and Water Flow codechef solution in c++ 
Cpp :: one away coding question 
Cpp :: pointers and arrays in c++ 
Cpp :: draw line sfml 
Cpp :: how to traverse through vector pair 
Cpp :: put function in cpp 
Cpp :: remove something from stringstream 
Cpp :: c/c++ windows api socket wrappers 
Cpp :: assignment operator with pointers c++ 
Cpp :: Start mongodb community server 
Cpp :: compare function in c++ 
Cpp :: c++ function pointer 
Cpp :: invert a binary tree 
Cpp :: define a type in c++ 
Cpp :: c++ stl 
Cpp :: online converter c++ to c 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =