#include <iostream> using namespace std; class addData //class to declare addData construct { public: addData(int inputAdd[2]); void writeData(int result); //intializes function to cout result to user }; class subData //class to declare subData construct { public: subData(int inputSub[2]); }; int main() { int i; //counter subData Sub(int inputSub[2]); //adds data obtained from loop into the construct addData Add(int inputAdd[2]); //adds data obtained from loop into the construct int addSub; //variable to determine to run thru add or subtract method int inputAdd[2]; //variables for add data int inputSub[2]; //variables for subtract data cout << "Press 1 to add 2 input numbers" << endl; cout << "Press 2 to subtract 2 input numbers" << endl; cin >> addSub; if(addSub == 1) //if option 1 is choosen { for(i = 0; i < 1; i++)//loop to obtain data and stores data on an array { cout << "Please enter number: " << i + 1 << endl; cin >> inputAdd[i]; } } if(addSub == 2) //if option 2 is chossen { for(i = 0; i < 1; i++) //loop to obtain data and stores data on an array { cout << "Please enter number: " << i + 1 << endl; cin >> inputSub[i]; } } } subData::subData(int inputSub[2]) //construct to subtract data { system("pause"); //only added so i could see if program was reaching this point or crashing before it int result; result = inputSub[0] - inputSub[1]; void writeData(int result); } addData::addData(int inputAdd[2]) //construct to add data { system("pause"); //only added so i could see if program was reaching this point or crashing before it int result; result = inputAdd[0] - inputAdd[1]; void writeData(int result); } void writeData(int result) { cout << "The result is: " << result << endl; system("pause"); //pauses so user can read result }

the program will compile and run, but it crashes after it ask for first number input, project was due 2 days ago, been trying to work thru it myself but having little success, thx for your help.