// 3.创建一个20个大小的随机数组,找出这组数组的最大值和最小值, 并且标出最大数和最小值的位置
#include<stdio.h>
#include<time.h>
void main()
{
int a[20];
time_t ts;
int Max, Min, temp;
int Minpos, MaxPos;
unsigned int data = time(&ts);
srand(data);//获取随机种子
//初始化数组
for (int i = 0; i < 20; i++)
{
a[i] = rand() % 300;
printf("%d ", a[i]);
}
#include<stdio.h>
#include<time.h>
void main()
{
int a[20];
time_t ts;
int Max, Min, temp;
int Minpos, MaxPos;
unsigned int data = time(&ts);
srand(data);//获取随机种子
//初始化数组
for (int i = 0; i < 20; i++)
{
a[i] = rand() % 300;
printf("%d ", a[i]);
}