Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c ifdef

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

c if statement

if(raining == 0 || (windSpeed > 15 && temperature < 10))// ** missing if statement **
  {
    printf("Stay indoors.
");
  }
  else
  {
    printf("You can go outside.
");
  }
  return 0;
}
Comment

C if Statement

if (test expression) 
{
   // code
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c define 
Cpp :: find in vector 
Cpp :: what is g++ and gcc 
Cpp :: how to initialize vector 
Cpp :: c++ builder 
Cpp :: convert integer to string in c++ 
Cpp :: Disabling console exit button c++ 
Cpp :: slice a vector c++ 
Cpp :: word equation numbers 
Cpp :: use of alphanumeric function c++, check if alphabet or digit from string 
Cpp :: How do I read computer current time in c++ 
Cpp :: Visual studio code include path not working c++ 
Cpp :: cpp detect os 
Cpp :: cpp auto 
Cpp :: getline() 
Cpp :: two elements with difference K in c++ 
Cpp :: read string with spaces in c++ 
Cpp :: how to make a function in c++ 
Cpp :: c++ data types 
Cpp :: c++ find index of element in array 
Cpp :: c++ std string to float 
Cpp :: one dimensiol array to two dimen c++ 
Cpp :: c++ variable type 
Cpp :: c++ comment out multiple lines 
Cpp :: google test assert throw 
Cpp :: c/c++ windows api socket wrappers 
Cpp :: statements 
Cpp :: evennumbers 1 to 100 
Cpp :: use set to get duplicates in c++ 
Cpp :: Program to find GCD or HCF of two numbers c++ 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =