Thread: Working with templates

  1. #1
    Registered User
    Join Date
    Apr 2013

    Working with templates


    Add a template to the arrayi.h class so that elements of the arrays can be integer, float or double. Also
    add a subtraction operator to the class.


    Get the arrayi.txt file. This file contains both the class definition along with it's implementation
    Your program is to have four files : lab3_client_driver.cpp, arrayi.h, arrayi.t and arrayi.cpp
    The diver is to demonstrate your changes.
    Create arrays A1, A2 and A3. A1 is size 4 with elements 6 7 8 9 A2 is size 7
    with elements 1 2 3 4 5 6 7. Assign A3 the difference of A1 and A2.
    It is advisable to do the above one at a time so if there are problems you know which is causing the problem

    My problem:

    What kind of file is the arrayi.t file? I cannot seem to create it in visual studio.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    I would guess you create an empty text file, then save it with the name you want.

    Most people seem to put templates in .h files anyway.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 03-30-2009, 04:09 AM
  2. templates
    By yosef_yaniv in forum C++ Programming
    Replies: 9
    Last Post: 02-04-2008, 12:30 PM
  3. c++ Templates
    By micha_mondeli in forum C++ Programming
    Replies: 5
    Last Post: 03-31-2005, 06:43 PM
  4. using templates
    By Benzakhar in forum Windows Programming
    Replies: 9
    Last Post: 11-24-2003, 06:53 PM
  5. Need help with templates
    By Flyer in forum C++ Programming
    Replies: 3
    Last Post: 06-30-2003, 10:12 AM