Title address: http://acm.nyist.net/JudgeOnline/problem.php?pid=31?? Describe
Design a program that takes the minimum and maximum numbers from 5 integers
Input
Enter only one set of test data, five positive integers not greater than 10,000
Output
Output two numbers, the first is the minimum of these five numbers, the second is the maximum value in these five numbers, and two numbers are opened with a blank.
Sample input
1 2 3) 4 5
Sample output
1 5? #include <stdio.h>
#define MAX_NUM 10000
#define MIN_NUM 0
int main ()
{
???? int min = max_num;
???? int max = Min_num;
????
???? int readnum = 0;
???? while (scanf ("%d", &readnum)! = EOF)
???? {
????????? if (Readnum < min)
????????? {
?????????????? min = Readnum;
????????? }
?????????
????????? if (Readnum > Max)
????????? {
?????????????? max = Readnum;
????????? }
???? }
????
???? printf ("%d%d\n", Min,max);
????
???? return 0;
}??? Note that the topics in this topic require the scope of input to find the most recommended code is only used stl OK, cow!
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace Std;
int main ()
{
???? int a[5];
???? Copy (istream_iterator<int> (CIN),istream_iterator<int> (), a);
???? Cout<<*min_element (a,a+5) << "" <<*max_element (a,a+5) <<endl;
}???????
???
08-Language Primer-08-5 number for maximum