Well, I've looked at a C++ tutorial, and decided to finish up the math functions.
WARNING: I have not tested this, although I am pretty sure it will work.
First, go to fnames.txt and add the following to the bottom of the file:
int choose(int arg1, int arg2, ...)
int mean(int arg1, int arg2, ...)
int median(int arg1, int arg2, ...)
Now, go to GMmathnc.h in ENIGMAsystem/SHELL/Universal_System and add this to the bottom of the file:
// May not be necessary; just in case ENIGMA doesn't include them already
#include <stdarg.h>
int choose(int num1, int num2, ...)
{
va_list choices;
int i;
int j=0;
int array[];
va_start(choices,num1);
for (i=arg1;i!=-1;i=va_arg(choices,int))
{
array[j]=i;
j+=1;
}
va_end(ap);
return array[random(j)];
}
int mean(int num1, int num2, ...)
{
va_list choices;
int i;
int j=0;
int total=0;
va_start(choices,num1);
for (i=arg1;i!=-1;i=va_arg(choices,int))
{
total+=i;
j+=1;
}
va_end(ap);
return total/j;
}
int median(int num1, int num2, ...)
{
va_list choices;
int i;
int j=0;
int array[];
va_start(choices,num1);
for (i=arg1;i!=-1;i=va_arg(choices,int))
{
array[j]=i;
j+=1;
}
va_end(ap);
return array[(int)((j-1)/2)];
}
PLEASE NOTE:
- The above functions only work with integers (no decimals/fractions).
- While they may not work in the setup I have provided, I am very positive that the scripts will work, and Josh may feel free to implement these into R4.