| Previous | Main | C & C++ Compilers | Next | Site Index | Download | Disclaimer | Privacy |


 

 

 

Using Borland C++ 6

 

 

 

 

 

 

 

 

  1. The following steps are for Win32 empty console mode application using IDE instead of command lines.  Launch the Borland C++ 6.  Click the File New Other…  It looks like this compiler is quite complex and heavy for a simple console mode application!

 

Borland C++ builder 6 compiler IDE

 

  1. When New Items dialog box appears, select the Console Wizard icon, then click the OK button.

 

Borland C++ builder 6 compiler IDE project items

 

   
  1. The Console Wizard dialog box appears as shown below.  Depend on your program, for this example, select the C++ radio button and check the Console Application check box.

Borland C++ builder 6 compiler IDE C or C++

   
  1. Copy and paste the following sample code into the editor as a practice.

 

#include <iostream>

using namespace std;

 

//-------class template declaration part---

template <class any_data_type>

class Test

{

    public:

    // constructor

    Test();

    // destructor

    ~Test();

    // function template

    any_data_type Data(any_data_type);

};

 

template <class any_data_type>

any_data_type Test<any_data_type>::Data(any_data_type Var0)

{return Var0;}

 

//------class template definition part--------

//----should be in the same header file with--

//----the class template declaration------

//constructor

template <class any_data_type>

Test<any_data_type>::Test()

{cout<<"Constructor, allocate..."<<endl;}

 

// destructor

template <class any_data_type>

Test<any_data_type>::~Test()

{cout<<"Destructor, deallocate..."<<endl;}

 

//--------main program--------

int main()

{

    Test<int> Var1;

    Test<double> Var2;

    Test<char> Var3;

    Test<char*> Var4;

   

    cout<<"\nOne template fits all data type..."<<endl;

    cout<<"Var1, int = "<<Var1.Data(100)<<endl;

    cout<<"Var2, double = "<<Var2.Data(1.234)<<endl;

    cout<<"Var3, char = "<<Var3.Data('K')<<endl;

    cout<<"Var4, char* = "<<Var4.Data("The class template")<<"\n\n";

    return 0;

}

 

Borland C++ builder 6 compiler IDE editor typing C/C++ codes   

   
  1. Then you can start building the program.  Select Project Build the_project_name.

Borland C++ builder 6 compiler IDE build C/C++ program

   
  1. The summary dialog box appears. Any error and/or warning count will be displayed at this moment and if any, you have to correct the error and/or warning before re-building the project.

Borland C++ builder 6 compiler IDE build messages

   
  1. If there is no error, you can start running the program.  Select Run menu Run submenu.

Borland C++ builder 6 compiler IDE run C/C++ program

   
  1. Finally the output.

Borland C++ builder 6 compiler IDE example of the console output

 

 

 

---www.tenouk.com---

 

 

 

 

 

 

Further digging:

 

  1. Check the best selling C, C++ and Compilers at Amazon.com.

 

 

 

 

 

 

 

| Previous | Main | C & C++ Compilers | Next | Site Index | Download | Disclaimer | Privacy |