Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c #define

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

#define in c

#define NAME "TechOnTheNet.com"
Comment

PREVIOUS NEXT
Code Example
Cpp :: cpp class constructor 
Cpp :: c++ string split 
Cpp :: classes constructor in c++ 
Cpp :: best websites for programming 
Cpp :: intersection.cpp 
Cpp :: no template named vector in namespace std 
Cpp :: Inner Section Sticky Scroll in elementor 
Cpp :: c++ replace 
Cpp :: c++ compile to exe command line 
Cpp :: how to download c++ portable compiler 
Cpp :: find in unordered_map c++ 
Cpp :: set width qpushbutton 
Cpp :: c++ preprocessor operations 
Cpp :: convert char to int c++ 
Cpp :: c++ get pointer from unique_ptr 
Cpp :: passing structure to function in c++ example 
Cpp :: class operator overloading c++ 
Cpp :: bfs to detect cycle in undirected graph 
Cpp :: do while c++ 
Cpp :: udo apt install dotnet-sdk-5 permission denied 
Cpp :: ue4 c++ replicate actor variable 
Cpp :: hello world cc++ 
Cpp :: c++ get data type 
Cpp :: c++ json parser euc-kr 
Cpp :: google test assert exception 
Cpp :: how to get last element of set 
Cpp :: tabeau dynamique c++ 
Cpp :: C++ to specify size and value 
Cpp :: c++ pointers and arrays 
Cpp :: array of charcter c++ 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =