Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c include

//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 elif 
Cpp :: if statement c++ 
Cpp :: notepad++ 
Cpp :: cpp while 
Cpp :: Convert a hexadecimal number into decimal c++ 
Cpp :: how to turn int into string c++ 
Cpp :: c++ initialize a vector 
Cpp :: ascii cpp 
Cpp :: life the universe and everything solution c++ 
Cpp :: c function as paramter 
Cpp :: constructor in cpp 
Cpp :: how to make a comment in c++ 
Cpp :: min element in vector c++ 
Cpp :: how to remove maximum number of characters in c++ cin,ignore 
Cpp :: c++ get whole line 
Cpp :: why convert char* to string c++ 
Cpp :: c++ changing string to double 
Cpp :: number of nodes of bst cpp 
Cpp :: overload subscript operator cpp 
Cpp :: how to input in cpp 
Cpp :: operator precedence in cpp 
Cpp :: create new node in tree 
Cpp :: print reverse number 
Cpp :: set iterator 
Cpp :: C++ String Concatenation Example 
Cpp :: c++ list of pairs 
Cpp :: c++ for loop syntax 
Cpp :: C++ Nested if 
Cpp :: Maximum sum of non consecutive elements 
Cpp :: c++ class constructor variable arguments 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =