pex10_1.cpp

来自「数据结构C++代码,经典代码,受益多多,希望大家多多支持」· C++ 代码 · 共 32 行

CPP
32
字号
#include <iostream.h>
#pragma hdrstop

#include "random.h"
#include "wex10_6.h"

void main(void)
{
	int a[10];
	RandomNumber rnd;
	
	// fill a with 10 random integers in the range 1..20000
	for(int i=0;i < 10;i++)
		a[i] = 1 + rnd.Random(20000);
		
	// print the array
	for(i=0;i < 10;i++)
		cout << a[i] << "  ";
	cout << endl;
	
	// use arraymax to print the maximum element of a
	cout << "The maximum value in the array is "
		 << arraymax(a,10) << endl;
}

/*
<Run>

1129  4163  6760  15717  18397  4403  2906  15974  2276  13943
The maximum value in the array is 18397
*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?