Finding max

#include <iostream>
using namespace std;
int main ()
{
int num, numNums, max,i;
cout<<"Please enter how many numbers you will enter:";
cin>>numNums;
max=0;
for(i=0; i<numNums; i++)
{
cout<<"Enter Number"<<(i+1)<<":";
cin>>num;
if(max<num)
{
max=num;
}
} // for
cout<<"The largest was"<<max<<"\n";
system ("pause")
}//main()


this is the program that i have to modify , such that the user will enter as many numbers as he/she wants until entered 0.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
using namespace std;
int main ()
{
  int num, numNums, max,i;
  cout<<"Please enter how many numbers you will enter:";
  cin>>numNums;
  max=0;

  for(i=0; i<numNums; i++)
  {
    cout<<"Enter Number"<<(i+1)<<":";
    cin>>num;
    if(max<num)
    {
      max=num;
    }
  } // for

  cout<<"The largest was"<<max<<"\n";
  system ("pause")

}//main() 


compiler says: syntax error on line 21!!!!!!!!!

hope this helps
Hello, Creshon.

It appears you have a missing semi-colon on the 21st line, after system( ).
Topic archived. No new replies allowed.