using

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Eric Kaplan

    using

    what's difference between using and include?

    does using is use for standard library only?

    ############### ##########

    #include <iostream>
    using std::cout;
    using std::left;
    using std::right;

    #include <iomanip>
    using std::setw;
  • Shobhit Gupta

    #2
    Re: using

    On Mar 10, 9:12 pm, Eric Kaplan <tobycraf...@ya hoo.comwrote:
    what's difference between using and include?
    >
    does using is use for standard library only?
    >
    ############### ##########
    >
    #include <iostream>
    using std::cout;
    using std::left;
    using std::right;
    >
    #include <iomanip>
    using std::setw;
    #include <iostreamis used for telling the compiler "Include iostream
    header file in the compilation"

    using std; //is used to tell the compiler "Use this namespace "std",
    because I don't want to type std:: before every cout"

    For more information about namespaces see
    Resources from the authors, creators, innovators, & leaders of technology - home to leading publishers Addison-Wesley Professional, & Sams.

    Comment

    • hurcan solter

      #3
      Re: using

      #include <iostreamis used for telling the compiler "Include iostream
      header file in the compilation"
      >
      using std; //is used to tell the compiler "Use this namespace "std",
      because I don't want to type std:: before every cout"
      I think there is a typo there ,this should read

      using namespace std;

      you have to put namespace in a using directive.

      Comment

      • Shobhit Gupta

        #4
        Re: using

        On Mar 10, 10:07 pm, hurcan solter <hsol...@gmail. comwrote:
        #include <iostreamis used for telling the compiler "Include iostream
        header file in the compilation"
        >
        using std; //is used to tell the compiler "Use this namespace "std",
        because I don't want to type std:: before every cout"
        >
        I think there is a typo there ,this should read
        >
        using namespace std;
        >
        you have to put namespace in a using directive.
        oh yeah, sorry for the typo. And thanks for pointing out.

        Comment

        Working...