What will be the output of the following C++ code? [code] #include <iostream> using namespace std; int main () {

What will be the output of the following C++ code?
Code:
    #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;
    }
A. 5
B. details about your file
C. compile time error
D. runtime error
 
Answer: b
Explanation: In this program, we are using the macros to print the information about the file.
Output:
Code:
$ g++ mac2.cpp
$ a.out
Value of __LINE__ : 5
Value of __FILE__ : mac1.cpp
Value of __DATE__ : Oct 10 2012
Value of __TIME__ : 22:24:37
 

Tìm kiếm

Back
Top