Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • Header Files in C++

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 76
    Comment on it

    Header Files in C++ are used to provide the functions and facilities that is used in our program to make our task easy to do and better way to perform.

     

    Header files provides the way through which you can print or  take input in our program which is a very basic functionality.

     

    Header File Function and Description
    <iostream> This file defines the cin, cout, cerr and clog objects, which correspond to the standard input stream, the standard output stream, the un-buffered standard error stream and the buffered standard error stream, respectively.
    <iomanip> This file declares services useful for performing formatted I/O with so-called parameterized stream manipulators, such as setw and setprecision.
    <fstream> This file declares services for user-controlled file processing. We will discuss about it in detail in File and Stream related chapter.

     

    The standard output stream (cout): 

    It is an instance of ostream class. It is used to display message from the program.

     

    #include <iostream>
     
    using namespace std;
     
    int main( )
    {
       char str[] = "Hello C++";
     
       cout << "Value of str is : " << str << endl;
    }

     

    The standard input stream (cin):

    It is an instance of istream class.It is used to take input from the user.

     

    #include <iostream>
     
    using namespace std;
     
    int main( )
    {
       char name[50];
     
       cout << "Please enter your name: ";
       cin >> name;
       cout << "Your name is: " << name << endl;
     
    }

     

    The standard error stream (cerr):

    The predefined object cerr is an instance of ostream class. It is used to define error message.

     

    #include <iostream>
     
    using namespace std;
     
    int main( )
    {
       char str[] = "Unable to read....";
     
       cerr << "Error message : " << str << endl;
    }

     

     

     

    .net

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: