Math Functions: The Sum of Integers of a Series



int __fastcall SumInt(const int * Data, const int Data_Size);

The SumInt() function is used to calculate the total of a group of integral numbers. This function takes two arguments. The first, Data, is the name of the array that holds the numbers. The numbers must be integers. If you want to calculate a total of floating-point numbers, use the Sum() function. The second argument, Data_Size is the size of the array minus one.

Here is an example that simulates a company inventory to count business assets:


#include <math.hpp>


int Assets[] = { 14, 18, 8, 12,
			 22, 6, 4, 1,
			 15, 42, 34, 9 };
int Items = (sizeof(Assets)/sizeof(int)) - 1;
int AllAssets = SumInt(Assets, Items);



Home Copyright © 2010-2016, FunctionX