// C6_4.cpp : Defines the entry point for the console application. // 函數以指標處理 #include "stdafx.h" #include using namespace std; double getavg(double* array, int nn); //函數原型宣告 int main(int argc, char* argv[]) { double values[] = { 92, 73, 88, 75, 66, 95, 100, 73, 96, 79 }; cout << endl << "平均值 = " << getavg(values, (sizeof values)/(sizeof values[0])); cout << endl; return 0; } // 計算平均值函數 double getavg(double* array, int nn) { double total = 0.0; // 宣告變數 for(int i = 0; i