#11498: What does for( ) mean?


warren (warren(爽啦))


#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
 
 int n,i,num,max=0;
 cin>>n;
 for(i=1; i<=n; ++i)
 {
  cin>>num;
  if(num>max) max=num;
 }
 cout<<max<<endl;
 
 return 0;
}
#11526: Re:What does for( ) mean?


tico88612 (Kagamine Rin)


#include
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
 
 int n,i,num,max=0;
 cin>>n;
 for(i=1; i<=n; ++i)
 {
  cin>>num;
  if(num>max) max=num;
 }
 cout<<max<<endl;
 
 return 0;
}

You enter number n. Ex.n=5 Next ,you will enter 5 num. choose max of that 5 numbers.