Problems finding the max!!! self teaching

I have been really working on trying to find the max in this array. I could use some help. if anyone could offer a hand telling me what I am doing wrong please tell me!

#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;

main (int nNumberofArgs, char* pszArgs[])
{

int max;
// the program loops 10 times

int array = 10;
int eLements[array]; // there are 10 elements
// tells the user to enter the number for which eatch person ate
cout << "there are 10 people eating pancakes"
<< " enter the number of pancakes each one"
<< " has eaten\n"<< endl;

for ( int i=0 ; i <10; i++ )
{
cout << "enter the 10 values";
cin>> eLements[i]; // values go into the array
}
max = eLements[0];

for(int i=1; i<10; i++)
{
if(max<eLements[i])
{
max = eLements [i];
}
}
cout << "the most pancakes eaten was" << max << endl;
cin.ignore(10, '\n');
cin.get();
return 0;

}
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
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;

int main(int nNumberofArgs, char* pszArgs[]) //missing int as the type specifier
{

	int max;
	// the program loops 10 times

	const int array = 10;
	int eLements[array]; // there are 10 elements ***You need a constant int to declare in the array***
	// tells the user to enter the number for which eatch person ate
	cout << "there are 10 people eating pancakes"
		<< " enter the number of pancakes each one"
		<< " has eaten\n" << endl;

	for (int i = 0; i <10; i++)
	{
		cout << "enter the 10 values";
		cin >> eLements[i]; // values go into the array
	}
	max = eLements[0];

	for (int i = 1; i<10; i++)
	{
		if (max<eLements[i])
		{
			max = eLements[i];
		}
	}
	cout << "The most pancakes eaten was " << max << endl;
	cin.ignore(10, '\n');
	cin.get();
	return 0;

}
oh wow the first mistake.... int main I cant believe that happened! I am starting to look at this code way to hard. Thanks for the help!!! I really appreciate it.
My pleasure!
Topic archived. No new replies allowed.