// Micheal H. McCabe
// CS-130 Professor Schuyler
// Assignment #20 -- Preliminary Work -- A Simple Calculator
//

#include <iostream>
#include <string>

using namespace std;

// Global Variables

bool still_wanted=true;
string command="";
char command_prefix;
float list [256];
float N1=0;
float N2=0;
float N3=0;

// Function Prototypes:

void help_screen();
string instruction();
void Enter_N1_N2();
void Adder();

// Main Routine

int main()
{
	help_screen();
	while (still_wanted)
	{
		instruction();
		command_prefix=command[0];
		switch (command_prefix)
		{
			case 'e' :	Enter_N1_N2();
					 	break;
			case 'a' :	Adder();
						break;

			/*
			case 'i' :	Enter_List();
						break;
			case 'fi':	File_Input();
						break;
			case 'fo':	File_Output();
						break;
			*/
		}
	}
	return 0;
}

void help_screen()
{
	cout << "The Simple Calculator \n \n";
	cout << "Enter Instruction: \n \n";
	cout << "		e : Enter a pair of numbers N1 and N2 \n";
	cout << "		i : Enter data into a list of numbers (list), stop on 'Q' \n";
	cout << "		fi: File input:  prompt for a filename and read values into list [] \n";
	cout << "		fo: File Output: prompt for a filename and write list values out. \n";
	cout << "		+ : Add (N1 + N2) \n";
	cout << "		- : Subtract (N1 - N2) \n";
	cout << "		* : Multiply (N1 * N2) \n";
	cout << "		/ : Divide (N1 / N2) \n";
	cout << "		^ : Raise any real N1 to the power of N2 for any integer N2 (+|-) \n";
	cout << "		! : Calculate the factorial for any integer N1 (round if real) \n";
	cout << "		c : Clear (N1, N2) \n";
	cout << "		cL: Clear the memory list of all values. \n";
	cout << "		h : Help \n";
	cout << "		l : List all the values currently in List () \n";
	cout << "		q : Quit \n";
	cout << "		o : Output the last calculation results to the screen. \n";
	cout << "		a : Average of the values in list [] \n";
	cout << "		d#: Delete the value at the index # in List [] \n";
	cout << "		m#: Memorize (save) the last calculation result at index # in list. \n";
	cout << "		s : Sum all the values in List [] \n";
	cout << "		sd: Calulate the standard deviation in the list [] \n";
	cout << "		p : Calculate the product of the values in the list \n";
	cout << "		M1: Prompt for index '#' and store N1 into list[#] \n";
	cout << "		M2: Prompt for index '#' and store N2 into list[#] \n";
	cout << "		N1: Prompt for index '#' and store List[#] into N1 \n";
	cout << "		N2: Prompt for index '#' and store List[#] into N2 \n";
}

string instruction()
{
	cout << "Instruction: ";
	cin >> command;
	cout << endl;
	return command;
}


void Enter_N1_N2()
{
	cout << "Enter N1: ";
	cin >> N1;
	cout << "Enter N2: ";
	cin >> N2;

	// Here is where the sanity checking routine will go!

	list[1]=N1;
	list[2]=N2;
}

void Adder()
{
	N3=N1+N2;
	cout << N1 << " + " << N2 << " = " << N3 << endl;
}



