reset( int a[], int m )
// Replace all numbers with random values.
r
| RESET
|
calc( a[], int m )
// Calculate total and average.
Also add some functions to do the following:
big( int a[], int m )
// Move biggest number to end of the array.
// (Swap array elements, to keep all numbers.)
small( int b[], int m )
// Move smallest to beginning of array
// (Swap, to keep all numbers.)
inc( int d[], int n )
// Increase each of the numbers by one.
dec( int a[], int m )
// Decrease each of the numbers by one.
dbl( int a[], int m )
// Double each of the numbers.
half( int a[], int m )
// FReduce each by half.
NOTE:
Do not use global values in these functions; use the arguments.
Write code in
keyPressed()
to call each function when a key is pressed,
with the first letter of that function.
r reset() // Replace with random values.
a calc() // Calculate sum and average. (*)
b big() // Move biggest to end of array.
s small() // Move smallest to beginning. (*)
+ inc() // Increase each by one. (*)
- dec() // Decrease each by one. (*)
d dbl() // Double each of the numbers. (*)
h half() // Reduce each by half. (*)
|
BUTTONS
create buttons with names for each of these,
and add
mousePressed()
code to call these functions when button is pressed.
| |