functions

I am getting these errors:
error C2660: 'displayList' : function does not take 0 arguments
error C2660: 'displaySortlist' : function does not take 0 arguments
error C2660: 'displaySortlist' : function does not take 0 arguments



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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
  #include <iostream>
#include <iomanip>
#include <fstream>

using namespace std;

void fileInput();
void displayList(const int[], int);
void sortedList(const int[], int);
void displaySortlist(const int[], int);
int searchFile(const int [], int, int);

int main()
{
	


	cout << "Charge Account Validation" << endl;
	cout << "created by Cedric Shumate" << endl << endl;
	fileInput();
	displayList();
	void sortedList();
	displaySortlist();
	searchFile();

	cout << "Enter a number in the account or 9999 to quit: ";
int number;
cin >> number;



while (number < 1 || number >9999)
{
	cout << "Error: Enter a number that is in the account: ";
	cin >> number;
}



	system("pause");
	return 0;
}

void fileInput()
{
	const int ARRAY_SIZE = 20;
	int accountNumbers[ARRAY_SIZE];
	int count = 0;
	ifstream inputFile;
	

	inputFile.open("charges.txt");
	while (count < ARRAY_SIZE && inputFile >> accountNumbers[count])
		count++;

	inputFile.close();

	

}

void displayList(const int ARRAY_SIZE[], int size)
{
	cout << "Original Order" <<endl;
	cout << "=========================" <<endl;

	for (int count = 0; count < size; count++)
		cout << ARRAY_SIZE[count];
	cout << endl;
}

void sortedList( int array[], int account)
{
	int startSort, minIndex, minNumb;
	
	for (startSort = 0; startSort < (account - 1); startSort++)
	{
		minIndex = startSort;
		minNumb = array[startSort];
		for (int index = startSort + 1; index < account; index++)
		{ 
			if (array[index] < minNumb)
			{
				minNumb = array[index];
				minIndex = index;
			}
		}
	
	}
}

void displaySortlist(const int ARRAY_SIZE[], int size)
{
	cout << "Sorted List" <<endl;
	cout << "*********************" <<endl;

	for (int count = 0; count < size; count++)
		cout << ARRAY_SIZE[count];
	cout << endl;
}

int searchFile ( const int array[], int account, int value)
{
	int first = 0,
		last = account - 1,
		middle, 
		position = -1;
	bool found = false;

	while (!found && first <= last)
	{ 
		middle = (first + last)/2;
		if (array[middle] == value)
		{
			found = true;
			position = middle;
		}
		else if (array[middle] > value)
			last = middle - 1;
		else 
			first = middle + 1; 
	}
	return position;
}
For displayList, line 8 says there are two parameters, but line 21 passes none.

When posting error messages, include the part of the error message that indicates the line number. Copy and paste the errors. It should have taken you directly to line 21 and 23. I am not sure where the third error is.
here is the whole error message:
1>d:\chargevalidation\chargevalidation\chargev.cpp(25): error C2660: 'displayList' : function does not take 0 arguments
1>d:\chargevalidation\chargevalidation\chargev.cpp(27): error C2660: 'displaySortlist' : function does not take 0 arguments
1>d:\chargevalidation\chargevalidation\chargev.cpp(28): error C2660: 'searchFile' : function does not take 0 arguments

each of your functions need parameters for each time you call them, such as displaylist(25, 2) your prototypes and your functions say they need 2 parameters each. but when you call them in main, it doesn't work because it's looking for those. the error message "function does not take 0 arguments" means that you tried to use 0 parameters, but it doesn't take 0, they take 2. So if you give your functions the proper arguments it should work
Topic archived. No new replies allowed.