so I have and for loop to find the highest number in and array how would i go about outputting the element number?

//compares the values in the yearAverage array to find the highest temperature
	for(int i=0; i<lineCount; i++)
	{
		if(yearAverage[i]>=highTemp)
		{
			highTemp = yearAverage[i];
		}

	}

add another variable to keep track of the element number and use it just like you do highTemp variable that appears on line 6 of the code you posted.

how would i do the element number then just like

element = i

inside the if statement?

thanks for the help ended up being exactly what i thought thanks for pointing me in the right direction

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.