Error- No matching call to function?

My job is to make a program that reads in 10 numbers, and only send out the distinct ones in the end. I am getting a semantic error, no matching call to function. Can anyone help me? Thanks.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// read in 10 numbers
// if they are distinct, keep them
// if not, dispose of them

#include <iostream>
#include <algorithm>
using namespace std;


const int SIZE = 4; // easier for testing
int final_list[SIZE];
int initial_list[SIZE];

void distinction (int n, bool exists);

int main()
{
    
    int number;

    cout << "Enter a list of ten numbers: " << endl;
    
    for (int i = 0; i < SIZE; i++)
        
            {
                cin >> number;
                initial_list[i] = number;
               
                for (int i = 0; i < SIZE; i++)
                    cout << " initial list " << initial_list[i] << " ";
                cout << endl;
                
                distinction(number); // error here
                
                for (int i = 0; i < SIZE; i++)
                cout << "Distinct numbers are: " << final_list[i];
                
            }
   
   
    return 0;
    
}


void distinction (int n, bool exists)
{
    for (int i = 0; i < SIZE; i++)
    {
             
    int n = initial_list[i]; // this is the value you are searching for
    
             bool exists = std::any_of(std::begin(initial_list), std::end(initial_list), [&](int i)
    
                {
                    return i == n;
                });
    
        if (exists == false)
            final_list[i] = n;
        
        else
            break;
    
    }

    
}

Line 14 - You declare distinction to take 2 arguments.
Line 33 - You call distinction with only one argument.
Line 56 - You attempt to return a boolean value from a void function.
Topic archived. No new replies allowed.