adsense


Friday, 27 November 2015

C++ LANGUAGE MACRO DESCRIPTION

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button



C++ LANGUAGE MACRO DESCRIPTION




Predefined C++ Macros 


C++ provides a number of predefined macros mentioned below: 


Macro          Description 

__LINE__  This contains the current line number 
                of the program when it is being compiled. 
__FILE__  This contains the current file name of the 
                program when it is being compiled. 
__DATE__  This contains a string of the form month/day/year 
                that is the date of the translation of the 
                source file into object code. 
__TIME__  This contains a string of the form 
                hour:minute:second that is the time at 
                which the program was compiled. 

Let us see an example for all the above macros: 
#include <iostream> 
using namespace std; 
 
int main () 
{ 
    cout << "Value of __LINE__ : " << __LINE__ << endl; 
    cout << "Value of __FILE__ : " << __FILE__ << endl; 
    cout << "Value of __DATE__ : " << __DATE__ << endl; 
    cout << "Value of __TIME__ : " << __TIME__ << endl; 
 
    return 0; 
} 
If we compile and run above code, this would produce the following result: 
Value of __LINE__ : 6 
Value of __FILE__ : test.cpp 
Value of __DATE__ : Feb 28 2011 
Value of __TIME__ : 18:52:48 



No comments: