📄 ex6_3.cpp
字号:
#include <iostream.h>
#include <stdlib.h>
const SIZE=15;
void main()
{
int arr[SIZE];
int i,high,low;
for (i=0;i<SIZE;i++) arr[i]=rand()%100;
cout << "Here are the " <<SIZE<<" roundom numbers :"<<endl;
for (i=0;i<SIZE;i++) cout<<arr[i]<<'\t';
cout<<endl;
high=arr[0]; //初始化时认为最大和最小值均为数组的第一个元素
low=arr[0];
for(i=1;i<SIZE;i++){
if(arr[i]>high) high=arr[i];
if(arr[i]<low) low=arr[i];
}
cout<<"highest value is "<<high<<endl;
cout<<"lowest value is "<<low<<endl;
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -