Simple issue but I am STUCK

This is a discussion on Simple issue but I am STUCK within the C++ Programming forums, part of the General Programming Boards category; O.k. this is so simple that it's embarrassing. I just can't seem to get it right. O.k. here's the basic ...

  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    10

    Simple issue but I am STUCK

    O.k. this is so simple that it's embarrassing. I just can't seem to get it right. O.k. here's the basic stuff first:

    • This is part of a class assignment, but this in itself is not THE assignment
    • I'm not in any way asking for a cheat. The template function is already done and ready to hand in.
    • The assignment involves the prototype and implementation of template functions
    • Compiler = Visual C++ 6.0


    O.k. so here's the issue. I can't seem to figure out how to properly call a template function in the main function. I know that this ought to be something simple, but @#$% if I'm not pulling out my hair trying to make it work. Here's a sample of my code:
    Code:
    #include <iostream>
    #include <queue>
    
    
    using namespace std;
    
    template <typename T>
    void n2front(queue<T>& q, int n);
    
    int main()
    {
    
    	n2front();  //Here is where I just can't seem to call the template function correctly
    
    	return(0);
    }
    
    template <typename T>
    void n2front(queue<T>& q, int n)
    {
    
    	// Perform the needed function operation for the assignment
    
    }
    All that I'm trying to do is simply call the template function n2front. I'm going crazy on this mostly because I know it ought to be simple. I am sure I am simply overlooking something.

    Any helpful comments are greatly appreciated.

    Thanks.

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,471
    Code:
    	queue<int> myQueue;
    
    	n2front(myQueue,10); //Here is where I just can't seem to call the template function correctly
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    Registered User
    Join Date
    Aug 2006
    Posts
    10
    Bingo. That did it. See I knew it was something simple like that. Thanks for the help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 12-30-2007, 09:08 AM
  2. Very Simple C Program
    By jennydarma in forum C Programming
    Replies: 4
    Last Post: 11-01-2002, 07:16 PM
  3. ...deceptively simple...
    By Sebastiani in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 07-29-2002, 12:51 PM
  4. Need help with simple DAQ program
    By canada-paul in forum C++ Programming
    Replies: 12
    Last Post: 03-15-2002, 07:52 AM
  5. Simple Compile Time Problem - HELP!
    By kamikazeecows in forum Windows Programming
    Replies: 2
    Last Post: 12-02-2001, 12:30 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21