pex10_2.cpp

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

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

#include "wex10_7.h"

void main(void)
{
	float a[50];
	
	// initialize to to have values 1,2,3,...,50
	for(int i=0;i < 50;i++)
		a[i] = i+1;
		
	// use avg to compute the average (51/2 = 25.5)
	cout << "The average of the values in the array is "
		 << avg(a,50) << endl;
}

/*
<Run>

The average of the values in the array is 25.5
*/

⌨️ 快捷键说明

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