投票系统作业
求老师给分#include <stdio.h>
void main()
{
int num;
int i,max,min,j,t;
int max_num(int num[]);
int min_num(int num[]);
for (i=0;i<10;i++)
{
printf("please input the %ds number: ",i+1);
scanf("%d",&num);
}
max=max_num(num);
min=min_num(num);
printf("%d %d\n",max,min);
for (j=0;j<10;j++)
{
if(num==max)
{
t=num;
num=max;
num=t;
}
if(num==min)
{
t=num;
num=min;
num=t;
}
}
for (i=0;i<10;i++)
{
printf("%d ",num);
}
}
int max_num(int num)
{
int j,max_=num;
for (j=0;j<9;j++)
{
if( num > max_)
max_=num;
}
return max_;
}
int min_num(int num)
{
int j,min_=num;
for (j=0;j<9;j++)
{
if (num < min_)
min_=num;
}
return min_;
}
不完整吧 不太懂== 感觉像是比较票数大小,跟小甲鱼老师的题有些出入
页:
[1]