/*
author: qcq
date: 2015/3/31
e-mail:
[email protected] */
#include<iostream>
#include<limits>
using namespace std;
int main()
{
int temp = 0;
/*
The method used here is below.
What we need is three variables, one for temp variable, one for max_number, one
for small number. Then scanning the input. what initial is to set max to the minimal number.
min number to max number.
*/
int big = INT_MIN;
int small = INT_MAX;
/*
when you want terminate the input, so you can input Crtl + D or Ctrl + Z.
Good luck to you.
*/
for (;cin>>temp;){
if (big < temp){
big = temp;
}
if (small > temp){
small = temp;
}
}
cout<<big<<endl<<small<<endl;
return 0;
}
追问大哥 我运行后输入数 没出现运行结果
追答输入完成之后输入Ctrl+D或者Ctrl+Z然后回车,你是按照我说的这样做的么?
追问厉害 666666666666