I have a two part assignment. Part one is to create a menu driven program using variables to do certain tasks. Part two is to convert the variables being used into 2 arrays. The code for part one is post below and works perfectly for everything that is required. My problem is I do not have the slightest clue about how to change all my variables being used into arrays and getting the program to even compile let alone run successfully. Thanks in advance for all your help.
HEADER.H
#include <iostream>
using namespace std;
#include <cmath>
const int SUCCESS = 0;
const int FAILURE = 1;
void mainMenu();
int getSum(int x, int y);
int getDifference(int a, int b);
int getProduct(int c, int d);
double computePower(double &e, double &f);
int getFact(int &g);
void binary(int h);
int sum = 0;
int difference = 0;
int product = 0;
double answer = 0;
int factorial = 1;
**************************************
MAIN.CPP
#include "header.h"
int main()
{
mainMenu();
return SUCCESS;
} // end of main
*****************************************
FUNCTIONS.CPP
#include "header.h"
void mainMenu(){
int option = 0;
int x = 0;
int y = 0;
int a = 0;
int b = 0;
int c = 0;
int d = 0;
double e = 0;
double f = 0;
int g = 0;
int h = 0;
cout << endl;
cout << "Choose an option you wish to execute." << endl;
cout << "[1] Add" << endl;
cout << "[2] Subtract" << endl;
cout << "[3] Multiply" << endl;
cout << "[4] Factorial" << endl;
cout << "[5] Binary" << endl;
cout << "[6] Power" << endl;
cout << "[7] Quit" << endl << endl;
cout << "Enter your choice now: ";
cin >> option;
if ( option <= 0 || option > 7 ){
cout << endl;
cout << "Option number not valid!" << endl << endl;
return;
} // end of if
if ( option == 1 ){
getSum(x,y);
cout << endl;
cout << "The sum is = " << sum << endl << endl;
mainMenu();
} // end of if
if ( option == 2 ){
getDifference(a,b);
cout << endl;
cout << "The difference is = " << difference << endl << endl;
mainMenu();
} // end of if
if ( option == 3 ){
getProduct(c,d);
cout << endl;
cout << "The product is = " << product << endl << endl;
mainMenu();
} // end of if
if ( option == 6 ){
computePower(e,f);
cout << endl;
cout << e << " to the power of " << f << " is " << answer << endl << endl;
mainMenu();
} // end of if
if ( option == 4 ){
getFact(g);
cout << endl;
cout << g << "! is " << factorial << endl << endl;
mainMenu();
} // end of if
if ( option == 5 ){
cout << endl;
cout << "Enter number: ";
cin >> h;
if ( h < 0 ){
cout << "Only positive numbers can be converted into binary, try again!" << endl << endl;
return;
} // end of if
cout << endl;
cout << "Your number converted to binary is: ";
binary(h);
cout << endl;
mainMenu();
} // end of if
if ( option == 7 ){
cout << endl;
cout << "Thank you for using our program, have a nice day =] " << endl << endl;
return;
} // end of if
} // end of function
//======================================
int getSum(int x, int y){
cout << endl;
cout << "Enter number: ";
cin >> x;
cout << endl;
cout << "Enter number: ";
cin >> y;
sum = x + y;
return sum;
} // end of function
//================================
int getDifference(int a, int b){
cout << endl;
cout << "Enter number: ";
cin >> a;
cout << endl;
cout << "Enter number: ";
cin >> b;
difference = a - b;
return difference;
} // end of fucntion
//===================================
int getProduct(int c, int d){
cout << endl;
cout << "Enter number: ";
cin >> c;
cout << endl;
cout << "Enter number: ";
cin >> d;
product = c * d;
return product;
} // end of function
//=======================================
double computePower(double &e, double &f){
cout << endl;
cout << "Enter number: ";
cin >> e;
cout << endl;
cout << "Enter power: ";
cin >> f;
answer = pow(e,f);
return answer;
} // end of function
//========================================
int getFact(int &g){
int n = 1;
cout << endl;
cout << "Enter number[1,12]: ";
cin >> g;
if ( g < 1 || g > 12 ){
cout << endl;
cout << "Factorial of " << g << " will not compute correctly, try again!" << endl << endl;
return FAILURE;
} // end of if
while ( n <= g ){
factorial = factorial * n;
n++;
} // end of while
return factorial;
} // end of function
//=========================================
void binary(int h){
int remainder;
if ( h <= 1 ){
cout << h;
return;
} // end of if
remainder = h % 2;
binary(h >> 1);
cout << remainder;
} // end of function
//===============================================