0

there are some problems in my coding which showing errors C2664 and C2562. i have no idea how to fix it...wish someone can point the problems and solutions too...

#include <iostream>

using namespace std;

const int listSize = 10;

void fillArray(int list[],int listSize);
void largest(const int list[],int listSize);
void printArray (const int list[], int listSize);

int main()
{
	int a;
	int b;

	cout<<"please enter the number pancakes that eaten by 10 peoples."<<endl;
	
	fillArray(a,b);
	printArray(a,b);

		return 1;
}

void fillArray(int list[], int listSize)
{
	int index;

	for(index=0;index<listSize;index++)
		cin>>list[index];
}

void printArray(const int list[],int listSize)
{
	int index;

	for(index=0;index<listSize;index++)
		cout<<list[index]<<" ";
}

void largest(const int list[],int listSize)
{
	int index;
	int maxIndex=0;

	

	for (index =1; index<listSize;index++)
		if (list[maxIndex]<list[index])
			maxIndex=index;

	return maxIndex;
}
3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Salem
0

Stop writing code that causes C2664 and C2562 errors would be a usable suggestion.

That might mean looking up what the errors mean and either memorizing the descriptions & sulutions or writing them down for future reference.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.