+ 1
How to find the largest and the smallest number? whereby ,user need to enter how many number he/she want ,using for loop
3 Answers
+ 1
what did you get so far?
hints: std::sort
and with c++17 min_element and max_element
http://en.cppreference.com/w/cpp/algorithm/min_element
+ 1
cin>>int a;
int q;
int max;
for (int i=0;i<a;i++){
cin>>q;
if (q>max){max=q;}
}
cout<<max;
0
thanks a lot đ„