// Name:     Micheal H. McCabe
// Date:     April 20, 2009
// Program:  Calculator V10 / Modular Version
// Filename: calc.h

// Include Various Libraries

#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <cmath>

#include <stddef.h>
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>

// Define the namespace

using namespace std;

#define MAX_USER_LIST 1000
#define HELP_e 	     "'e'  to enter N1 and N2\n"
#define HELP_i       "'i'  to enter a list of values (Q to stop)\n"
#define HELP_fi      "'fi' File input:  prompt for a filename and read values into list [] \n"
#define HELP_fo      "'fo' File Output: prompt for a filename and write list values out. \n"
#define HELP_plus    "'+'  Add (N1 + N2) \n"
#define HELP_minus   "'-'  Subtract (N1 - N2) \n"
#define HELP_star    "'*'  Multiply (N1 * N2) \n"
#define HELP_slash   "'/'  Divide (N1 / N2) \n"
#define HELP_caret   "'^'  Raise any real N1 to the power of N2 for any integer N2 (+|-) \n"
#define HELP_exclaim "'!'  Calculate the factorial for any integer N1 (round if real) \n"
#define HELP_c       "'c'  Clear (N1, N2) \n"
#define HELP_cL      "'cL' Clear the memory list of all values. \n"
#define HELP_h       "'h'  Help \n"
#define HELP_l       "'l'  List all the values currently in List () \n"
#define HELP_q       "'q'  Quit \n"
#define HELP_o       "'o'  Output the last calculation results to the screen. \n"
#define HELP_a       "'a'  Average of the values in list [] \n"
#define HELP_d       "'d#' Delete the value at the index # in List [] \n"
#define HELP_m       "'m#' Memorize (save) the last calculation result at index # in list. \n"
#define HELP_s       "'s'  Sum all the values in List [] \n"
#define HELP_sd      "'sd' Calulate the standard deviation in the list [] \n"
#define HELP_p       "'p'  Calculate the product of the values in the list \n"
#define HELP_M1      "'M1' Prompt for index '#' and store N1 into list[#] \n"
#define HELP_M2      "'M2' Prompt for index '#' and store N2 into list[#] \n"
#define HELP_N1      "'N1' Prompt for index '#' and store List[#] into N1 \n"
#define HELP_N2      "'N2' Prompt for index '#' and store List[#] into N2 \n"
#define NO_COMMAND   " No command recognized \n"
#define CMD_PROMPT   "Enter Command: "

// Declare the fancy new datatype

struct NewDataView

	{
	int Used;
	float N1;
	float N2;
	float Last_Result;
	float Array[MAX_USER_LIST];
	};

// Function Prototypes

int add(NewDataView& Data);
int sub(NewDataView& Data);
int mult(NewDataView& Data);
int div(NewDataView& Data);
int exponent(NewDataView& Data);
int mod(NewDataView& Data);
int sum(NewDataView& Data);
int product(NewDataView& Data);
int mean(NewDataView& Data);
int deviant(NewDataView& Data);
double long factorial(int x);
int ReadInputFile(NewDataView& Data);
int WriteOutputFile(NewDataView& Data);
void list_data(NewDataView& Data);
bool get_numeric(string prompt, string stop, float& output);
void getN1N2(NewDataView& Data);
void clearl(NewDataView& Data);
void clearn(NewDataView& Data);
void helpscreen();
void output_last(NewDataView& Data);
void GetArray(NewDataView& Data);
int directory();
int GetNumArg (string command_line);
int deletelist(int p, NewDataView& Data);
int moveresult(int p, NewDataView& Data);
void storen1(NewDataView& Data);
void storen2(NewDataView& Data);
void loadn1(NewDataView& Data);
void loadn2(NewDataView& Data);

