Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6771319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:25:04+00:00 2026-05-26T15:25:04+00:00

I am trying to organize my program into functions and have ran into this,

  • 0

I am trying to organize my program into functions and have ran into this,

error: “missing template arguments before ‘.’ token”

once I try to run the code in the function, it works fine if its just in main(). Anyone familiar with this error know what the issue may be?

Note, the commented out code removes the error but messes with the ordered list class and resets its length or something, causing the orderedlist.getlength() function to return 0, which makes none of the code in the while() loop execute.

function:

void rentFilm(char* filmId, char* custId, char* rentDate, char* dueDate, int numFilm)
{
    //orderedList <filmType> orderedList(numFilm);
    //filmType newItem;
    int index = 0;
    bool found = false;

    while (index < orderedList.getLength() && !found)
        {
            cout << "test" << endl;
        if (strncmp(filmId,orderedList.getAt(index).number,6) == 0 && strncmp("0000",orderedList.getAt(index).rent_id,5) == 0)//If that film is rented by NO customer
            {
                cout << "test" << endl;
                found = true;//customer can rent it
                strcpy(newItem.number,filmId);
                orderedList.retrieve(newItem);
                orderedList.remove(newItem);
                strcpy(newItem.rent_id,custId);
                strcpy(newItem.rent_date,rentDate);
                strcpy(newItem.return_date,dueDate);
                orderedList.insert(newItem);
                cout << "Rent confirmed!" << endl;
            }
        else
            {
                if (strncmp(filmId,orderedList.getAt(index).number,6) > 0 || strncmp("0000",orderedList.getAt(index).rent_id,5) > 0)
                    {
                        ++ index;
                    }
                else
                    {
                     throw string ("Not in list");
                    }
            }
        }
}

Insert in orderedList class (where length is determined):

template <class elemType>
void orderedList<elemType>::insert(const elemType& newItem)
{
     int index = length - 1;
     bool found = false;

     if (length == MAX_LIST)
         throw string ("List full - no insertion");

         // index of rear is current value of length

     while (! found && index >= 0)
        if (newItem < list[index])
        {
            list[index + 1] = list [index];  // move item down
            --index;
        }
        else
            found = true;

     list [index + 1] = newItem;  // insert new item
     ++length;
}

code in main where list is filled:

filmFile.open("films.txt", ios::in);
filmFile >> numFilm;
filmFile.get();

orderedList <filmType> orderedList(numFilm);
filmType newItem;

readString(filmFile, newItem.number,5);
    for (int i = 0; i < numFilm; i++)
    {
         newItem.copy = filmFile.get();
     readString(filmFile, newItem.title,30);
         readString(filmFile, newItem.rent_id,4);
         readString(filmFile, newItem.rent_date,8);
         readString(filmFile, newItem.return_date,8);
         filmFile.get();

         orderedList.insert (newItem);//puts filmType struct into the ordered list.

         readString(filmFile, newItem.number,5);
    }

Please let me know if code from anywhere else in the program would be helpful in assessing this error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:25:05+00:00Added an answer on May 26, 2026 at 3:25 pm

    It looks like the line you commented out declares a variable with the same name as a class.

    So when you comment it out, static functions of that class are getting invoked.

    Change the declaration to something like:

    orderedList<filmType> filmList(numFilm);
    

    and then change all the references of orderedList in the function to filmList.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to organize my application into packages because it will have several
I am trying to organize a Zip Archive into an array so that I
Trying to get my css / C# functions to look like this: body {
Trying to make a MySQL-based application support MS SQL, I ran into the following
I am trying to organize my code using the revealing module pattern. I have
I am trying to organize some modules for my own use. I have something
I'm trying to work out how to organize an android application that will have
trying to run this program. I think that to setup all of the web
I am trying to organize my code and move repetitive functions to a single
I'm trying to jump through some hoops to organize data in a special way.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.