Explain the #define directive, C/C++ Programming

Assignment Help:

The #define Directive

The #define directive explains a macro which is a text string represented by a name. Whenever the pre-processor finds this name in the program, it is replaced by the text string it shows. The is an following example which explains a value and gives it a name PI.

                #define PI 3.14285    // no semicolon given

                void main()

                 {

                                cout << PI;

                 }

This program is equivalent to :

                void main()

                 {

                                cout << 3.14285;

                 }

The  # define directive works strictly on the basis of substitution of a text string for the macro names.

 


Related Discussions:- Explain the #define directive

Program of cascading, Program of cascading: class vector{          ...

Program of cascading: class vector{                 private :                 int v[3];                   public:                 friend istream & operator >> (

How do i develop a subscript operator for a matrix class?, Employ operator ...

Employ operator () instead of operator[]. While you have multiple subscripts, the cleanest way to do it is along with operator () instead of with operator[]. The reason is that

Luminous Jewels - The Polishing Game, Byteland county is very famous for lu...

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

I need website with built in scraper, I need Website with built in scraper ...

I need Website with built in scraper Project Description: The coding skills mentioned above are just possibly ones that will be used. Skills required are ASP, C++ Programm

Write a program to change the matrix program, Change the matrix program (pr...

Change the matrix program (program 3) slightly. Overload == operator to compare two matrices to be added or subtracted. i.e., whether the column of first and the row of second

Area under the curve, Write a program to find the area under the curve y ...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

C program for change the case in title case, #include stdio.h> #include ...

#include stdio.h> #include conio.h> #include ctype.h> #include string.h>   void main() {           int i=0,j=0,length;           char a[30];           cl

Area under a curve, Write a program to find the area under the curve y = f(...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Basic C++ Velocity and Momentum Program, Write a program that does the foll...

Write a program that does the following: Calculates the Velocity and Momentum of an object. The formula for the velocity is V=d/t and the formula Momentum is m=mass*velocity. Your

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd