Search
 
SCRIPT & CODE EXAMPLE
 

CPP

cpp detect os

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

PREVIOUS NEXT
Code Example
Cpp :: cpp ifdef 
Cpp :: c++ loop through list 
Cpp :: ++ how to write quotation mark in a string 
Cpp :: cpp map insert 
Cpp :: count number of prime numbers in a given range in c 
Cpp :: 31. Next Permutation leetcode solution in c++ 
Cpp :: resize string c++ 
Cpp :: How to turn an integer variable into a char c++ 
Cpp :: C++ String Compare Example 
Cpp :: how to replace part of string with new string c++ 
Cpp :: how to add space in c++ 
Cpp :: c++ shell 
Cpp :: variables in c++ 
Cpp :: cpp execute command 
Cpp :: C++ Calculating the Mode of a Sorted Array 
Cpp :: ue4 c++ replicate actor variable 
Cpp :: sum of first 100 natural numbers 
Cpp :: UENUM ue4 
Cpp :: create a vector of size n in c++ 
Cpp :: rethrow exception c++ 
Cpp :: age in days in c++ 
Cpp :: C++ if...else...else if statement 
Cpp :: cyclically rotate an array by once 
Cpp :: How to pass a multidimensional array to a function in C and C++ 
Cpp :: split string in c++ 
Cpp :: options select from array 
Cpp :: abs c++ 
Cpp :: c++ function overloading 
Cpp :: data type c++ 
Cpp :: cpp algorithm iota 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =