Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c detect OS

//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 :: if statement c++ 
Cpp :: iterate through list c++ 
Cpp :: compute power of number 
Cpp :: letter occurrence in string c++ 
Cpp :: how many months have 31 days 
Cpp :: opengl draw semi circle c++ 
Cpp :: c++ base constructor 
Cpp :: c++ if example 
Cpp :: c++ in cmd 
Cpp :: c++ output current timestamp 
Cpp :: show stack c++ 
Cpp :: cpp array init value 
Cpp :: c++ pre-processor instructions 
Cpp :: attention nlp 
Cpp :: factorial of large number 
Cpp :: log base 2 in c++ 
Cpp :: initialize a vector to 0 
Cpp :: how to have a queue as a parameter in c++ 
Cpp :: resize vector c++ 
Cpp :: stack class implementation to file unix-style in c++ 
Cpp :: convert wchar_t to to multibyte 
Cpp :: QVariant to int 
Cpp :: makefile for single cpp file 
Cpp :: flutter single instance app 
Cpp :: how to use for c++ 
Cpp :: declare a tab c++ 
Cpp :: backtrack 
Cpp :: c++ map 
Cpp :: stl map remove item 
Cpp :: stack data structure c++ 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =