Each function should accept two arguments:
NOTE:
Do not use global variables in these functions;
Here is an example of code that displays an array:
This function returns the sum of the elements:
|
These functions are called
Action | Key | Button | ||||||
---|---|---|---|---|---|---|---|---|
reset( int a[], int m )
// Replace all numbers with random values. | r | RESET | ||||||
calc( int a[], int m )
// Calculate new total and average. | c | CALC | ||||||
next( int a[], int m )
// Increase each of the numbers by one. | n | NEXT | ||||||
dbl( int a[], int m )
// Double each of the numbers. | d | DOUBLE | ||||||
half( int a[], int m )
// Reduce each by half. | h | HALF | ||||||
big( int a[], int m )
// Move biggest number to end of the array. // (Swap elements, to preserve all numbers.) | b | BIG | ||||||
sort( int a[], int m )
// Sort the entire array. | s | SORT | ||||||
NOTE:
Do not use global values in these functions;
| ||||||||
| and add mousePressed() code to call these functions when button is pressed. |