i am having two problems with my code. the first error message highlighted in green says i need to return a value instead of what i have written down. and the line highlighted in red says that my value is not being ignored. can anyone help? I am totally lost. here is my code:
#include <iostream>
using namespace std;
const int MAXELS = 1000;
void readList(int nums [], int size);
void printList( int list[], int size);
void printbackward(int list[], int size);
void findmaxLocation (int list[], int size);
void swap(int&x, int&y);
void sort(int list[], int size);
int main()
{
int j;
int theList[MAXELS];
readList (theList, 5);
printList (theList, 5);
printbackward (theList, 5);
sort (theList, 5);
cin >> j;
return 0;
}
void readList(int nums [], int size)
{
int i;
for(i=0; i < size; i++)
cout << "Enter the " << i + 1 << " number" << endl;
cin >> nums[i];
}
void printList( int list[], int size)
{
int i;
for(i = 0; i < size; i++)
cout << "List[" << i << "] is" <<list[i] << endl;
}
void printbackward(int list[], int size)
{
int i;
for(i = (size - 1); i >= 0; i--)
cout << list[i-1];
}
void findmaxLocation (int list[], int size)
{
int max, maxlocation;
max = list[0];
maxlocation = 0;
for(int i = 1; i < size; i++)
if (max < list[i])
{
max = list[i];
maxlocation = i;
}
return maxlocation;
}
void swap(int&x, int&y)
{
int temp;
temp = x;
x = y;
y = temp;
}
void sort(int list[], int size)
{
int unsorted_size = size;
int indexofMax;
while (unsorted_size > 1)
{
indexofMax = findmaxLocation (list, unsorted_size);
swap (list[indexofMax], list[unsorted_size-1]);
unsorted_size--;
}
}