#include
using namespace std;
void main() //测试用例
{
int values[5], maxval, position;
cout<<"请输入5个整数,以空格隔开:";
cin>>values[0] >> values[1] >>values[2] >>values[3] >>values[4] ;
position = 0;
maxval = values[0];
for (int index = 0; index < 5; index++)
{
if (maxval < values[index])
{
position = index;
maxval = values[index];
}
}
cout<<"最大值为"<
}
#include "stdafx.h"
int get_maxval(int *valarry, int elem_num)
{
if(NULL == valarry)
return -1;
int max = valarry[0];
for(int i=1;i
max = (max
return max;
}
int _tmain(int argc, _TCHAR* argv[])
{
int buf[5] = {0};
//require the user to input the value
for(int i=0;i<5;i++)
{
printf("Please your int type number-NO.%d:\n",i+1);
scanf("%d",buf+i);
}
//get the max one
int max_num = get_maxval(buf, sizeof(buf)/sizeof(int));
//printf the result
printf("The max value is:%d\n",max_num);
return 0;
}
t;a;
cin>>b;
if(a>b) cout<else if(a==b) cout<<"these numbers are equal";
else cout<
2.cout<<"Input three different intergers:";
int a,b,c;
cin>>a;
cin>>b;
cin>>c;
while(a==b||a==c||b==c)
{
cout<<"the numbers must be different,please input again:";
cin>>a;
cin>>b;
cin>>c;
}
cout<<"Sum is "<cout<<"Average is "<<(double)(a+b+c)/(double)3<
if(a{
if(a
sml=a;
if(b
}
else
}
else{
if(a
{
lag=a;
if(b>c) sml=c;
else sml=b;
}
}
cout<<"Smallest is "<
*
**
***
****
*****
4.
int num[5];
for(int i=0;i<5;i++)
{cin>>num[i];
}
int max=num[0],mark=0;
for(int i=1;i<5;i++)
{
if(num[i]>max)
}
cout<<"第"<5.int a;
cin>>a;
if(a%2==0) cout<<"是偶数"<