Thread: Subroutines

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    20

    Exclamation Subroutines

    How, in Borland C++, do you make Subroutines? If its code and not the compiler can you list the code?

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    #include <iostream>

    using namespace std;

    void Subroutine()
    {
    cout << "This is a subroutine for the Borland C++"
    "compiler. You don't need to double post";
    }

  3. #3
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    what does "using namespace std;" mean?

  4. #4
    Evil Member
    Join Date
    Jan 2002
    Posts
    638
    Well, you notice he #include'd <iostream> instead of <iostream.h>

    If there is no .h, the functions of iostream are dumped into a namespace, called std

    So to call them, you would preface calls with std:: such as

    std::cout<<"Whatever";

    using namespace std makes the functions found in namespace std available to the global namespace. thus calling cout automatically looks for cout in std.

    It is the modern coding standard to include headers without the .h and place a using namespace std after the #includes.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Does C Support Subroutines
    By AQWst in forum C Programming
    Replies: 7
    Last Post: 12-10-2004, 11:13 PM
  2. LAPACK linking...
    By ashesh in forum Tech Board
    Replies: 2
    Last Post: 08-18-2003, 03:42 AM
  3. calling subroutines to populate array??help
    By gravitybass in forum C Programming
    Replies: 1
    Last Post: 04-07-2003, 12:23 AM
  4. Using functions (subroutines)
    By DoItAllMom115 in forum C++ Programming
    Replies: 11
    Last Post: 03-16-2003, 04:48 PM
  5. Subroutines
    By drdroid33 in forum C++ Programming
    Replies: 1
    Last Post: 02-02-2002, 07:01 PM