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;
#include <cstdio>
#include <cstdlib>
#include <iostream>
usingnamespace std;
int main(int nNumberofArgs, char* pszArgs[]) //missing int as the type specifier
{
int max;
// the program loops 10 times
constint 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.