Ryan Bury

Assignment #1 for CMPSC 311

Here is the basic description for the program given verbatim:

In this assignment you will develop a program to manage several data types, data structures and arrays. The purpose of this exercise is to either remind or familiarize yourselves with the basics of C programming, as well as to expose yourself to the management and use of UNIX.

If you would like to view the instructions in their entirety click here. These instructions are the intellectual property of Professor Patrick McDaniel.

Download Code and Executable



Output

Here is what the output of the program looks like. In order to receive this when you run the program, you must pipe the "test-input1.txt" into the program.

Floating point arrary:
float[0] = 14.100
float[1] = 1.450
float[2] = 3288.009
float[3] = 661.263
float[4] = 0.000
float[5] = 410.181
float[6] = 0.988
float[7] = 91.480
float[8] = 81.810
float[9] = 461.108
float[10] = 7.501
float[11] = 11.100
float[12] = 478.478
float[13] = 6.330
float[14] = 90.870
float[15] = 1.480
float[16] = 1161.198
float[17] = 18.540
float[18] = 0.500
float[19] = 664.353

Integer arrary:
integer[0] = 14
integer[1] = 1
integer[2] = 3288
integer[3] = 661
integer[4] = 0
integer[5] = 410
integer[6] = 1
integer[7] = 91
integer[8] = 82
integer[9] = 461
integer[10] = 8
integer[11] = 11
integer[12] = 478
integer[13] = 6
integer[14] = 91
integer[15] = 1
integer[16] = 1161
integer[17] = 19
integer[18] = 1
integer[19] = 664


The floating point array has 11 even numbers,and the integer array has 9 even numbers.

Array (3^i) mod 17
arr[0] = 1
arr[1] = 3
arr[2] = 9
arr[3] = 10
arr[4] = 13
arr[5] = 5
arr[6] = 15
arr[7] = 11
arr[8] = 16
arr[9] = 14
arr[10] = 8
arr[11] = 7
arr[12] = 4
arr[13] = 12
arr[14] = 2
arr[15] = 6
arr[16] = 1
arr[17] = 3
arr[18] = 9
arr[19] = 10
arr[20] = 13
arr[21] = 5
arr[22] = 15
arr[23] = 11
arr[24] = 16

Value 1 is a most frequently occuring value (2 times).
Value 3 is a most frequently occuring value (2 times).
Value 5 is a most frequently occuring value (2 times).
Value 9 is a most frequently occuring value (2 times).
Value 10 is a most frequently occuring value (2 times).
Value 11 is a most frequently occuring value (2 times).
Value 13 is a most frequently occuring value (2 times).
Value 15 is a most frequently occuring value (2 times).
Value 16 is a most frequently occuring value (2 times).

Array (3^i) mod 19
arr[0] = 1
arr[1] = 3
arr[2] = 9
arr[3] = 8
arr[4] = 5
arr[5] = 15
arr[6] = 7
arr[7] = 2
arr[8] = 6
arr[9] = 18
arr[10] = 16
arr[11] = 10
arr[12] = 11
arr[13] = 14
arr[14] = 4
arr[15] = 12
arr[16] = 17
arr[17] = 13
arr[18] = 1
arr[19] = 3
arr[20] = 9
arr[21] = 8
arr[22] = 5
arr[23] = 15
arr[24] = 7

Value 1 is a most frequently occuring value (2 times).
Value 3 is a most frequently occuring value (2 times).
Value 5 is a most frequently occuring value (2 times).
Value 7 is a most frequently occuring value (2 times).
Value 8 is a most frequently occuring value (2 times).
Value 9 is a most frequently occuring value (2 times).
Value 15 is a most frequently occuring value (2 times).



                    Graph: D = cos(x)*1.0, E = sin(x)*1.0
       -------------------------------------------------------------
  3.0 |                              |                              |
  2.9 |                              |                              |
  2.8 |                              |                              |
  2.7 |                              |                              |
  2.6 |                              |                              |
  2.5 |                              |                              |
  2.4 |                              |                              |
  2.3 |                              |                              |
  2.2 |                              |                              |
  2.1 |                              |                              |
  2.0 |                              |                              |
  1.9 |                              |                              |
  1.8 |                              |                              |
  1.7 |                              |                              |
  1.6 |                              |                              |
  1.5 |                              |                              |
  1.4 |                              |                              |
  1.3 |                              |                              |
  1.2 |                              |                              |
  1.1 |                              |                              |
  1.0 |            EEEEEE         DDDDDDD                           |
  0.9 |         EEE      EE     DD   |   DD                         |
  0.8 |        E           EE DD     |     DD                       |
  0.7 |      EE              E       |       D                      |
  0.6 |     E               D EE     |        D                     |
  0.5 |    E              DD    E    |         DD                   |
  0.4 |   E              D       E   |           D                  |
  0.3 |  E              D         E  |            D                 |
  0.2 | E              D           E |             D                |
  0.1 |E              D             E|              D               |
  0.0 |--------------D---------------E---------------D--------------|
 -0.1 |             D                |E               D            E|
 -0.2 |            D                 | E               D          E |
 -0.3 |           D                  |  E               D        E  |
 -0.4 |          D                   |   E               D      E   |
 -0.5 |         D                    |    E               D    E    |
 -0.6 |        D                     |     EE              D  E     |
 -0.7 |      DD                      |       E              EE      |
 -0.8 |     D                        |        EE           E  D     |
 -0.9 |  DDD                         |          EE      EEE    DDD  |
 -1.0 |DD                            |            EEEEEE          DD|
 -1.1 |                              |                              |
 -1.2 |                              |                              |
 -1.3 |                              |                              |
 -1.4 |                              |                              |
 -1.5 |                              |                              |
 -1.6 |                              |                              |
 -1.7 |                              |                              |
 -1.8 |                              |                              |
 -1.9 |                              |                              |
 -2.0 |                              |                              |
 -2.1 |                              |                              |
 -2.2 |                              |                              |
 -2.3 |                              |                              |
 -2.4 |                              |                              |
 -2.5 |                              |                              |
 -2.6 |                              |                              |
 -2.7 |                              |                              |
 -2.8 |                              |                              |
 -2.9 |                              |                              |
 -3.0 |                              |                              |

      -3        -2        -1        0          1         2         3         
       0123456789012345678901234567890123456789012345678901234567890
       -------------------------------------------------------------


                    Graph: D = cos(x)*1.3, E = sin(x)*2.3
       -------------------------------------------------------------
  3.0 |                              |                              |
  2.9 |                              |                              |
  2.8 |                              |                              |
  2.7 |                              |                              |
  2.6 |                              |                              |
  2.5 |                              |                              |
  2.4 |                              |                              |
  2.3 |             EEEE             |                              |
  2.2 |           EE    E            |                              |
  2.1 |          E       E           |                              |
  2.0 |         E         E          |                              |
  1.9 |        E           E         |                              |
  1.8 |                     E        |                              |
  1.7 |       E                      |                              |
  1.6 |      E               E       |                              |
  1.5 |                       E      |                              |
  1.4 |     E                        |                              |
  1.3 |                        E   DDDDD                            |
  1.2 |    E                     DD  |  DD                          |
  1.1 |                        DE    |    DD                        |
  1.0 |   E                   D      |      D                       |
  0.9 |                      D   E   |       D                      |
  0.8 |  E                  D        |        D                     |
  0.7 |                    D      E  |         D                    |
  0.6 | E                 D          |          D                   |
  0.5 |                  D         E |           D                  |
  0.4 |                              |                              |
  0.3 |E                D            |            D                 |
  0.2 |                D            E|             D                |
  0.1 |               D              |              D               |
  0.0 |--------------D---------------E---------------D--------------|
 -0.1 |                              |                              |
 -0.2 |             D                |E               D             |
 -0.3 |            D                 |                 D           E|
 -0.4 |           D                  |                  D           |
 -0.5 |          D                   | E                 D          |
 -0.6 |                              |                            E |
 -0.7 |         D                    |  E                 D         |
 -0.8 |        D                     |                     D     E  |
 -0.9 |       D                      |   E                  D       |
 -1.0 |     DD                       |                       DD E   |
 -1.1 |    D                         |    E                    D    |
 -1.2 |  DD                          |                         EDD  |
 -1.3 |DD                            |     E                      DD|
 -1.4 |                              |                        E     |
 -1.5 |                              |      E                       |
 -1.6 |                              |       E               E      |
 -1.7 |                              |                      E       |
 -1.8 |                              |        E                     |
 -1.9 |                              |         E           E        |
 -2.0 |                              |          E         E         |
 -2.1 |                              |           E       E          |
 -2.2 |                              |            E    EE           |
 -2.3 |                              |             EEEE             |
 -2.4 |                              |                              |
 -2.5 |                              |                              |
 -2.6 |                              |                              |
 -2.7 |                              |                              |
 -2.8 |                              |                              |
 -2.9 |                              |                              |
 -3.0 |                              |                              |

      -3        -2        -1        0          1         2         3         
       0123456789012345678901234567890123456789012345678901234567890
       -------------------------------------------------------------


                    Graph: D = cos(x)*0.6, E = sin(x)*4.3
       -------------------------------------------------------------
  3.0 |                              |                              |
  2.9 |      E                       |                              |
  2.8 |                       E      |                              |
  2.7 |                              |                              |
  2.6 |     E                        |                              |
  2.5 |                              |                              |
  2.4 |                        E     |                              |
  2.3 |                              |                              |
  2.2 |    E                         |                              |
  2.1 |                         E    |                              |
  2.0 |                              |                              |
  1.9 |                              |                              |
  1.8 |   E                          |                              |
  1.7 |                          E   |                              |
  1.6 |                              |                              |
  1.5 |                              |                              |
  1.4 |  E                           |                              |
  1.3 |                           E  |                              |
  1.2 |                              |                              |
  1.1 |                              |                              |
  1.0 | E                            |                              |
  0.9 |                            E |                              |
  0.8 |                              |                              |
  0.7 |                              |                              |
  0.6 |E                         DDDDDDDDD                          |
  0.5 |                       DDD    |    DDD                       |
  0.4 |                     DD      E|       DD                     |
  0.3 |                   DD         |         DD                   |
  0.2 |                 DD           |           DD                 |
  0.1 |                D             |             D                |
  0.0 |--------------DD--------------E--------------DD--------------|
 -0.1 |            DD                |                DD            |
 -0.2 |          DD                  |                  DD          |
 -0.3 |         D                    |                    D         |
 -0.4 |      DDD                     |E                    DDD      |
 -0.5 |   DDD                        |                        DDD   |
 -0.6 |DDD                           |                           DDE|
 -0.7 |                              |                              |
 -0.8 |                              |                              |
 -0.9 |                              | E                            |
 -1.0 |                              |                            E |
 -1.1 |                              |                              |
 -1.2 |                              |                              |
 -1.3 |                              |  E                           |
 -1.4 |                              |                           E  |
 -1.5 |                              |                              |
 -1.6 |                              |                              |
 -1.7 |                              |   E                          |
 -1.8 |                              |                          E   |
 -1.9 |                              |                              |
 -2.0 |                              |                              |
 -2.1 |                              |    E                         |
 -2.2 |                              |                         E    |
 -2.3 |                              |                              |
 -2.4 |                              |     E                        |
 -2.5 |                              |                              |
 -2.6 |                              |                        E     |
 -2.7 |                              |                              |
 -2.8 |                              |      E                       |
 -2.9 |                              |                       E      |
 -3.0 |                              |                              |

      -3        -2        -1        0          1         2         3         
       0123456789012345678901234567890123456789012345678901234567890
       -------------------------------------------------------------


*-assign1.c

////////////////////////////////////////////////////////////////////////////////
//
//  File           : cmpsc311-f16-assign1.c
//  Description    : This is the main source code for for the first assignment
//                   of CMPSC311 at Penn State University.  See the related
//                   assignment page for details.
//
//   Author        : Ryan Bury
//   Last Modified : 8/29/2016

// Include Files
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

// Project Includes
#include <cmpsc311-f16-assign1-support.h>

//
// Functions

////////////////////////////////////////////////////////////////////////////////
//
// Function     : main
// Description  : The main function for the CMPSC311 assignment #1
//
// Inputs       : argc - the number of command line parameters
//                argv - the parameters
// Outputs      : 0 if successful test, -1 if failure

int main(int argc, char *argv[]) {

	// Local variables
	// f_array_size must equal i_array-size 
	float f_array[20];
	int f_array_size = 20;

	int i_array[20];
	int i_array_size = 20;

    int m_array[25];
	//int m_array_size = 25; Not needed since we use 25 below

	int i;

	// Step #1 - read in the float numbers to process
	for (i=0; i<f_array_size; i++) {
		scanf("%f", &f_array[i]);
	}

	// Step #2 - convert the input values
	// Converts: 
	//  - Values >= 15: multiplied times pi^2
	//  - Values <  15: Absolute value
    for(i=0; i<f_array_size; i++) 
	{
		if(f_array[i] >= 15) 
			f_array[i] *= pow(M_PI, 2);
		else
			f_array[i] = fabs(f_array[i]);
	}

    // Step #3 - convert the floating point values to integers
	// Converts array of floats to array of integers by rounding
	//   to closest value. 
    for(i=0; i<f_array_size; i++)
	{
		i_array[i] = round(f_array[i]);
	}
    // Step #4 - print out the integer and floating point arrays
	float_display_array(f_array, f_array_size);
	integer_display_array(i_array, i_array_size);

    // Step #4 - figure out number of evens in each array
    printf("Floating point array: %i even numbers. Integer array: %i even " 
		"numbers. \n\n", float_evens(f_array, f_array_size), 
		integer_evens(i_array, i_array_size));

    // Step #5 - fill up the new array, coune most frequent values 
    make_array(m_array, 25, 3, 17);
    most_values(m_array, 25, 16);
    make_array(m_array, 25, 3, 19);
    most_values(m_array, 25, 18);

    // Step #6 graph out functions
    printf("\n\n");
    graph_functions(1.0, 1.0);
    printf("\n\n");
    graph_functions(1.3, 2.3);
    printf("\n\n");
    graph_functions(0.6, 4.3);

	// Return successfully
	return(0);
}



*-assign1-support.c

////////////////////////////////////////////////////////////////////////////////
//
//  File          : cmpsc311-f16-assign1-support.c
//  Description   : This is the implementation of functions declared in 
//		*-support.h for Assignment #1. 
//
//  Author   : Ryan Bury
//  Created  : 8/29/2016

#include $#60math.h$#62
#include $#60stdio.h$#62
#include $#60stdlib.h$#62

////////////////////////////////////////////////////////////////
// See related .h file for description and usage of functions //
////////////////////////////////////////////////////////////////

int float_display_array(float arr[], int size)
//Displays an array of float values. 
{
	printf("Floating point array: \n");
	for(int i = 0; i $#60 size; i ++)
	{
		printf("float[%i] = %.3f \n", i, arr[i]);
	}
	printf("\n");
	return 0;
}

int integer_display_array(int arr[], int size)
//Displays an array of integer values
{
	printf("Integer array: \n");
	for(int i = 0; i $#60 size; i ++)
	{
		printf("integer[%i] = %i \n", i, arr[i]);
	}
	printf("\n");
	return 0;
}

int float_evens(float arr[], int size)
//Returns number of even numbers in an array of floats.
//Ignores all data after "."
//  e.g. 60.34 will be treated as 60 
{
	int evens = 0;

	for(int i = 0; i $#60 size; i++)
	{
		int a = arr[i];
		if(a%2==0)
			evens++;
	}
	return evens;
}

int integer_evens(int arr[], int size)
//Returns number of even numbers in array of integers
{
	int evens = 0;

	for(int i = 0; i $#60 size; i++)
	{
		if(arr[i]%2==0)
			evens++;
	}
	return evens;
}

int make_array(int *arr, int range, int exp, int md)
//Modifies arr so each element abides by the following: 
//  arr[i] = (exp^i)%md
{
	printf("Array[i] = (%i^i)%%%i \n", exp, md);
	for(int i = 0; i $#60 range; i++)
	{
		int a = fmod(pow(exp, i), md);
		printf("arr[%i] = %i \n", i, a);
		arr[i] = a;
	}
	printf("\n");
	return 0;
}

int most_values(int arr[], int range, int maxval)
//Prints out the value(s) which occur the most times in the array
{
	int max = 0;
	int *value;
	//dynamically allocate array that contains from 0 to maxval
	value = calloc(maxval+1, sizeof(int));
	//Set all values in value to 0
	for(int i = 0; i $#60= maxval; i++) value[i]=0;

	//Increment value at index of the number, also check the max occurrences
	for(int i = 0; i $#60 range; i++)
	{
		value[arr[i]]+=1;
		if(value[arr[i]] $#62 max)
			max = value[arr[i]];
	}

	//Print max occurrences
	for(int i = 1; i $#60= maxval; i++)
	{
		if(value[i] == max)
			printf("Value %i is a most frequently occurring value " 
			"(%i times).\n", i, max);
	}
	//Free dynamically allocated memory (leaks are bad)
	free(value);
	
	printf("\n");
	
	return 0;
}

int graph_functions(float mult1, float mult2)
//Prints graphs of y = cos(x)*mult1 and y = sin(x)*mult2. 
{
/*
      ------------------------------------------------------------- 
 3.0 |                              |                              |
 2.9 |                              |                              |
 2.8 |                              |                              |
 2.7 |                              |                              |
 2.6 |                              |                              |
 2.5 |                              |                              |
 2.4 |                              |                              |
 2.3 |                              |                              |
 2.2 |                              |                              |
 2.1 |                              |                              |
 2.0 |                              |                              |
 1.9 |                              |                              |
 1.8 |                              |                              |
 1.7 |                              |                              |
 1.6 |                              |                              |
 1.5 |                              |                              |
 1.4 |                              |                              |
 1.3 |                              |                              |
 1.2 |                              |                              |
 1.1 |                              |                              |
 1.0 |                              |                              |
 0.9 |                              |                              |
 0.8 |                              |                              |
 0.7 |                              |                              |
 0.6 |                              |                              |
 0.5 |                              |                              |
 0.4 |                              |                              |
 0.3 |                              |                              |
 0.2 |                              |                              |
 0.1 |                              |                              |
 0.0 |------------------------------|------------------------------|
-0.1 |                              |                              |
-0.2 |                              |                              |
-0.3 |                              |                              |
-0.4 |                              |                              |
-0.5 |                              |                              |
-0.6 |                              |                              |
-0.7 |                              |                              |
-0.8 |                              |                              |
-0.9 |                              |                              |
-1.0 |                              |                              |
-1.1 |                              |                              |
-1.2 |                              |                              |
-1.3 |                              |                              |
-1.4 |                              |                              |
-1.5 |                              |                              |
-1.6 |                              |                              |
-1.7 |                              |                              |
-1.8 |                              |                              |
-1.9 |                              |                              |
-2.0 |                              |                              |
-2.1 |                              |                              |
-2.2 |                              |                              |
-2.3 |                              |                              |
-2.4 |                              |                              |
-2.5 |                              |                              |
-2.6 |                              |                              |
-2.7 |                              |                              |
-2.8 |                              |                              |
-2.9 |                              |                              |
-3.0 |                              |                              |
      -------------------------------------------------------------
     -3        -2        -1         0         1         2         3
      0987654321098765432109876543210123456789012345678901234567890
*/
	int i = 0;
	char graph[68][65];
	//Fill graph with spaces
	for(int x = 0; x $#60 68; x ++)
	{
		for(int y = 0; y $#60 65; y ++)
		{
			graph[x][y] = ' ';
		}
	}

	////////////////////////////
	//Generate axes and labels//
	////////////////////////////

	//Horizontal axes
	for(int x = 6; x $#60 67; x++)
	{
		graph[x][0] = '-';  //Top
		graph[x][31] = '-'; //Middle
		graph[x][62] = '-'; //Bottom
	}
	//Vertical axes
	for(int y = 1; y $#60 62; y++)
	{ 
		graph[5][y] = '|';  //Left
		graph[36][y] = '|'; //Center
		graph[67][y] = '|'; //Right
	}
	//X labels
	graph[5][63] = '-'; graph[6][63] = '3'; // "-3"
	graph[15][63] = '-'; graph[16][63] = '2'; // "-2"
	graph[25][63] = '-'; graph[26][63] = '1'; // "-1"
	graph[36][63] = '0';
	graph[46][63] = '1';
	graph[56][63] = '2'; 
	graph[66][63] = '3';
	i = 0;
	for(int x = 6; x $#60 37; x++)
	{
		//Converts int to char
		graph[x][64] = i + '0';
		i--;
		if(i == -1) i = 9;
	}
	i = 1;
	for(int x = 37; x $#60 67; x++)
	{
		graph[x][64] = i + '0';
		i++;
		i = i%10;
	}
	//Y labels
	for(int y = 1; y $#60 62; y++)
	{
		graph[2][y] = '.';
		if(y $#62 31) graph[0][y] = '-';
		if((y == 1) | (y == 61)) graph[1][y] = '3';
		if(((y $#62= 2) & (y $#60= 11)) | ((y $#62= 51) & (y $#60= 60))) graph[1][y] = '2';
		if(((y $#62= 12) & (y $#60= 21)) | ((y $#62= 41) & (y $#60= 50))) graph[1][y] = '1';
		if((y $#62= 22) & (y $#60= 40)) graph[1][y] = '0';

		if(y $#60= 31) graph[3][y] = (31-y)%10 + '0';
		else graph[3][y] = (y-31)%10 + '0';
	}

	/////////////////
	//Generate Plot//
	/////////////////

	char plot[61][61];
	//Fill plot with spaces
	for(int x = 0; x $#60 61; x++)
	{
		for(int y = 0; y $#60 61; y++)
		{
			plot[x][y] = ' ';
		}
	}

	//Graph lines in plot
	for(int i = 0; i $#60 61; i++)
	//i and j correspond to the x and y axes in ascii from 0 to 60
	//x and y correspond to the cartesian coordinates from -3 to 3
	{
		float x;
		x = (i*.1)-3;
		
		//Graph D
		float y1, j1;
		y1 = cos(x)*mult1;			
		j1 = (y1+3)*10; 
		int ji1 = round(j1);
		if(ji1 $#62= 0 && ji1 $#60 61) plot[i][ji1] = 'D';

		//Graph E
		float y2, j2;
		y2 = sin(x)*mult2;
		j2 = (y2+3)*10;
		int ji2 = round(j2);
		if(ji2 $#62= 0 && ji2 $#60 61) plot[i][ji2] = 'E';

		//Fill area between graphs E and D
		
		//Switch ji1 and ji2 so ji2 is the larger value
		if(ji2 $#60 ji1) 
		{ int temp = ji1; ji1 = ji2; ji2 = temp; }

		for(int j = ji1+1; j $#60 ji2; j++)
		{
			if(j $#62= 0 && j $#60 61) plot[i][j] = '+';
		}
		
	}

	//////////////////////////
	//Combine Plot and Graph//
	//////////////////////////

	for(int x = 6; x $#60 67; x++)
	{
		for(int y = 1; y $#60 62; y++)
		{
			if(!(plot[x-6][61-y] == ' '))
				graph[x][y] = plot[x-6][61-y];
				//The display has the y-axis reversed, (62-y) corrects this phenomenon. 
		}
	}

	/////////////////
	//Display Graph//
	/////////////////


	printf("\t\t    D = cos(x)*%.1f, E = sin(x)*%.1f\n", mult1, mult2);
	for(int y = 0; y $#60 65; y++)
	{
		for(int x = 0; x $#60 68; x++)
		{
			printf("%c", graph[x][y]);
		}
		printf("\n");
	}

	return 0;
}


*-assign1-support.h

#ifndef CMPSC311_A1SUPPORT_INCLUDED
#define CMPSC311_A1SUPPORT_INCLUDED

////////////////////////////////////////////////////////////////////////////////
//
//  File          : cmpsc311-f16-assign1-support.h
//  Description   : This is a set of general-purpose utility functions we use
//                  for the 311 homework assignment #1.
//
//  Author   : Ryan Bury
//  Created  : 8/29/2016

/////////////////////////////////////////////////////////////////////////
// See cmpsc311-f16-assign1-support.c for implementation of functions. //
/////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
//
//  Function    : float_display_array
//  Description : Displays an array of floating point values. 
// 
//  Inputs      : arr[] - an array of type float 
//		: size  - the size of arr[]
//  Outputs	: 0 if successful, -1 if failure

int float_display_array(float arr[], int size);
	
////////////////////////////////////////////////////////////////////////////////
//
//  Function    : integer_display_array
//  Description : Displays an array of integer values. 
// 
//  Inputs      : arr[] - an array of type int
//		: size  - the size of arr[]
//  Outputs	: 0 if successful, -1 if failure

int integer_display_array(int arr[], int size);

////////////////////////////////////////////////////////////////////////////////
//
//  Function    : float_evens
//  Description : Finds the number of even numbers in an array of floats. 
// 	Ignores all data after '.'
// 
//  Inputs      : arr[] - an array of type float
//		: size  - the size of arr[]
//  Outputs	: number of even numbers in array 

int float_evens(float arr[], int size);

////////////////////////////////////////////////////////////////////////////////
//
//  Function    : integer_evens
//  Description : Finds the number of even numbers in an array of integers. 
// 
//  Inputs      : arr[] - an array of type int
//		: size  - the size of arr[]
//  Outputs	: number of even numbers in array

int integer_evens(int arr[], int size);

////////////////////////////////////////////////////////////////////////////////
//
//  Function    : make_array
//  Description : Creates a new array with elements defined by the following: 
//	 - arr[i] = (exp^i)%md
//	Technically modifies arr[] rather than creating a brand new array. 
// 
//  Inputs      : arr[] - an array of type int
//		: range - the range of arr[] (Same as size)
//		: exp   - an integer to be used when creating the array
//		: md    - an integer to be used when creating the array
//  Outputs	: 0 if successful, -1 if failure

int make_array(int *arr, int range, int exp, int md);

////////////////////////////////////////////////////////////////////////////////
//
//  Function    : most_values
//  Description : Displays the most frequently occurring values in arr[]. 
// 
//  Inputs      : arr[] - an array of type int
//		: range - the range of arr[] (Same as size)
//		: maxval - the maximum value that could occur in arr[]
//  Outputs	: 0 if successful, -1 if failure

int most_values(int arr[], int range, int maxval);

////////////////////////////////////////////////////////////////////////////////
//
//  Function    : graph-functions
//  Description : plots y = cos(x)*mult1 and y = sin(x)*mult2 in this: 
//
//      ------------------------------------------------------------- 
// 3.0 |                              |                              |
// 2.9 |                              |                              |
// 2.8 |                              |                              |
// 2.7 |                              |                              |
// 2.6 |                              |                              |
// 2.5 |                              |                              |
// 2.4 |                              |                              |
// 2.3 |                              |                              |
// 2.2 |                              |                              |
// 2.1 |                              |                              |
// 2.0 |                              |                              |
// 1.9 |                              |                              |
// 1.8 |                              |                              |
// 1.7 |                              |                              |
// 1.6 |                              |                              |
// 1.5 |                              |                              |
// 1.4 |                              |                              |
// 1.3 |                              |                              |
// 1.2 |                              |                              |
// 1.1 |                              |                              |
// 1.0 |                              |                              |
// 0.9 |                              |                              |
// 0.8 |                              |                              |
// 0.7 |                              |                              |
// 0.6 |                              |                              |
// 0.5 |                              |                              |
// 0.4 |                              |                              |
// 0.3 |                              |                              |
// 0.2 |                              |                              |
// 0.1 |                              |                              |
// 0.0 |------------------------------|------------------------------|
//-0.1 |                              |                              |
//-0.2 |                              |                              |
//-0.3 |                              |                              |
//-0.4 |                              |                              |
//-0.5 |                              |                              |
//-0.6 |                              |                              |
//-0.7 |                              |                              |
//-0.8 |                              |                              |
//-0.9 |                              |                              |
//-1.0 |                              |                              |
//-1.1 |                              |                              |
//-1.2 |                              |                              |
//-1.3 |                              |                              |
//-1.4 |                              |                              |
//-1.5 |                              |                              |
//-1.6 |                              |                              |
//-1.7 |                              |                              |
//-1.8 |                              |                              |
//-1.9 |                              |                              |
//-2.0 |                              |                              |
//-2.1 |                              |                              |
//-2.2 |                              |                              |
//-2.3 |                              |                              |
//-2.4 |                              |                              |
//-2.5 |                              |                              |
//-2.6 |                              |                              |
//-2.7 |                              |                              |
//-2.8 |                              |                              |
//-2.9 |                              |                              |
//-3.0 |                              |                              |
//      -------------------------------------------------------------
//     -3        -2        -1         0         1         2         3
//      0987654321098765432109876543210123456789012345678901234567890
//
// 	Also fills space in between graphs to satisfy honors requirement
//	* Most notably, the functions are graphed correctly unlike in 
//		test-output1.txt
// 
//  Inputs      : mult1 - multiplier 1 to multiply against cos(x)
//		: mult2 - multiplier 2 to multiply against sin(x)
//  Outputs	: 0 if successful, -1 if failure

int graph_functions(float mult1, float mult2);

#endif // CMPSC311_A1SUPPORT_INCLUDED