#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.
#include <iostream>
usingnamespace 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()