Write a program using preprocessor directives

Estudies4you
Q46. Write a program using preprocessor directives.
Answer:

Program
#include <iostream>
#define a 100
#define MAX 10
#define MIN 1
using namespace std;
int main(void)
{
#if (a==100)
cout<<"Value of a is matched \n";
#else
cout<<"Value of a does not match\n";
#endif
#ifdef MAX
cout<<"\nMAX is defined.\n";
#else
cout<<"\nMAX is not defined.\n";
#endif
#ifndef MIN
cout<<"MIN is not defined.\n"<<endl;
#else
cout<<"MIN is defined.\n"<<endl;
#endif
#undef MIN
#ifdef MIN
cout<<"\nMIN is defined.\n";
#else
cout<<"\nMIN is not defined.\n";
#endif
return 0;

}
Output
Explain dynamic memory allocation and deallocation operators in c++,Dynamic Memory Allocation in c++,Dynamic Memory Deallocation in c++,use of new operator in c++,use of delete operator in c++,examples of dynamic memory allocations in c++,c++ lecture notes,c++ notes,c++ study material,c++ previous question papers,oops using c++ notes,oops using c++ lecture notes,oops using c++ study material,oops through c++ notes,oops through c++ study material,oops through c++ lecture notes,c++ notes jntuh,c++ notes jntu,jntu c++ notes,

To Top