-2
void DISPLAY(user u[],int Tuser);

struct user
{
    queue<float> time ;
    queue<string> purpse;
}users[5];

int main()
{
//codes
    DISPLAY(users,Tuser);//here is the problem
    return 0;
}

void DISPLAY(user u[], int Tuser)
{
    for (int i = 0; i < Tuser; i++)
    {
        while (!(u[i].purpse.empty()))
        {
            cout << u[i].purpse.front()<<"\n";
            u[i].purpse.pop();
        }
        cout << "\n";
        
        while (!(u[i].time.empty()))
        {
            cout << u[i].time.front()<<"\n";
            u[i].time.pop();
        }
        cout << "\n";
    }   
}

It says there is an error on this line:

DISPLAY(users,Tuser);

What is the solution?

Error (active) E0308 more than one instance of overloaded function "DISPLAY" matches the argument list:

the image of problem

Remy Lebeau
  • 505,946
  • 29
  • 409
  • 696
Anonumous
  • 13
  • 3
  • 1
    Click on the error line with "Redefinition" in it. Go see the previous definition. Should explain the problem. – Jeffrey Aug 07 '21 at 01:08
  • 3
    Please create a [mcve] and post the error(s) (or better, the compiler output) as text, not an image. – chris Aug 07 '21 at 01:13
  • I would be more concerned with the illegal use of the type void error. I think you minimized the code too much and left out the actual errors. Also you should look at the errors in the Output tab. Remember its important to look at the errors in file order as 1 error can cause many others. – drescherjm Aug 07 '21 at 01:15
  • 1
    That's an IntelliSense "hint", and is the least important of your issues. Once you have fixed the other *actual* problems, it will go away. (I would recommend that you switch off IntelliSense until you're experienced enough to tell false positives from real errors with reasonable accuracy.) – molbdnilo Aug 07 '21 at 01:52
  • Isn't it just that you can't define the DISPLAY function twice? – a544jh Aug 08 '21 at 12:09

1 Answers1

0

Try This

    #include<bits/stdc++.h>
using namespace std;
//void DISPLAY(user u[],int Tuser);

struct user
{
    queue<float> time ;
    queue<string> purpse;
}users[5];


void DISPLAY(user u[], int Tuser)
{
    for (int i = 0; i < Tuser; i++)
    {
        while (!(u[i].purpse.empty()))
        {
            cout << u[i].purpse.front()<<"\n";
            u[i].purpse.pop();
        }
        cout << "\n";

        while (!(u[i].time.empty()))
        {
            cout << u[i].time.front()<<"\n";
            u[i].time.pop();
        }
        cout << "\n";
    }

}


int main()
{
//codes
    int Tuser=0;
    DISPLAY(users,Tuser);//here is the problem
    return 0;
}
Nik
  • 11
  • 2
  • You probably need to explain what you changed and why. Also msvc / visual-c++ will not work with the gcc only first line. – drescherjm Aug 07 '21 at 02:35
  • You have not defined 'Tuser ' in main function... and your code should have in proper structure....you declared fuction that uses struct parameter before structure declaration.......follow sequence....1.struct 2. Function 3. Main function – Nik Aug 07 '21 at 03:12
  • 1
    [Why should I not #include ?](https://stackoverflow.com/questions/31816095/) – Remy Lebeau Aug 07 '21 at 04:13