Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c pre-processor instructions

//INCLUDING BUILT-IN LIBRARIES...
#include <stdio.h>
#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

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

    printf(END);    //using pre-defined string
    return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c detect os 
Cpp :: find element in vector 
Cpp :: priority queue in c++ 
Cpp :: stack implementation through linked list 
Cpp :: print pattern and space in cpp 
Cpp :: error handling in c++ 
Cpp :: how to get hcf of two number in c++ 
Cpp :: how to slice vector in c++ 
Cpp :: what is meant by pragma once in c++ 
Cpp :: c++ function as paramter 
Cpp :: set to vector 
Cpp :: check if a key is in map c++ 
Cpp :: c++ #define 
Cpp :: c++ auto 
Cpp :: c++ tuple 
Cpp :: map in cpp 
Cpp :: inheritance in c++ 
Cpp :: how to reverse a vector in c++ 
Cpp :: data types in c++ 
Cpp :: selection sort c++ 
Cpp :: how to empty a std vector 
Cpp :: how to access a vector member by its index 
Cpp :: for statement c++ 
Cpp :: char array declaration c++ 
Cpp :: bubble sort c++ 
Cpp :: bit++ codeforces in c++ 
Cpp :: tabeau pseudo dynamique sur c++ 
Cpp :: string append at position c++ 
Cpp :: Temparory Email Id 
Cpp :: c language all keywords in string 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =