fork download
#include 
#include 
#include 
#include  //library for files
#include 
#include 
#include 
#include 
#include 


using namespace std;

template 
void alloc3DArray(T *** &x, int numberOfRows, int numberOfColumns,int numberOfDepth  )
{

 int i=0;
 int j=0;
 int k=0;


 // allocate an array for array of arrays
  x = new T ** [numberOfRows];


 // Allocate an array for each element of the first array
   for(i = 0; i < numberOfRows; i++)
    {

        x[i] = new T *[numberOfColumns];

  // Allocate an array of T for each element of this array
        for(j = 0; j < numberOfColumns; j++)
        {

            x[i][j] = new T [numberOfDepth];

   // Specify an initial value 
   for(int k = 0; k < numberOfDepth; ++k)
   {
    x[i][j][k] = -1;


   }


        }
    }

}

template 
void dealloc3DArray(T *** &x, int numberOfRows, int numberOfColumns )

{
 // Check if it exeists 
 if(!x) //it does not exist
         exit(1);



    for (int i = 0; i < numberOfRows; ++i) 
    {
   for (int j = 0; j < numberOfColumns; ++j)

        {
    //delete innest
            delete [] x[i][j]; 
        }

   //delete columns
        delete [] x[i];
    }
 //delete first array
    delete [] x;
}

template 
const vector  allOperationsNotWorking(T *** &myArray1, T *** &myArray2,  T *** &myArray3,int numberOfRows, int numberOfColumns,int numberOfDepth  )

{
    int i=0;
 int j=0;
 int k=0;

    int size = numberOfRows * numberOfColumns * numberOfDepth; //find vector size
    vector &myvector = vector(size);// create a vector
    //vector::const_iterator it;// const_iterator is faster than iterator
    for(i = 0; i < numberOfRows; i++)
   for(j = 0; j < numberOfColumns; j++)
    for(k = 0; k < numberOfDepth; k++){

     myArray3[i][j][k] =myArray1[i][j][k]+myArray2[i][j][k];

     myvector.push_back(myArray3[i][j][k]);


    }
     return myvector;


}

vector  allOperationsString(string *** &myArray1, string *** &myArray2,  string *** &myArray3,int numberOfRows, int numberOfColumns,int numberOfDepth  )

{
    int i=0;
 int j=0;
 int k=0;

    int size = numberOfRows * numberOfColumns * numberOfDepth; //find vector size
    vector myvector = vector(size);// create a vector
    //vector::const_iterator it;// const_iterator is faster than iterator
    for(i = 0; i < numberOfRows; i++)
   for(j = 0; j < numberOfColumns; j++)
    for(k = 0; k < numberOfDepth; k++){

     myArray3[i][j][k] =myArray1[i][j][k]+myArray2[i][j][k];

     myvector.push_back(myArray3[i][j][k]);


    }
     return myvector;


}

template 
vector isWord(vector &stringVector, vector &goodOnes,vector &badOnes, vector &dict)
{
    vector strV;


 if (typeid(stringVector).name()== typeid(strV).name()){

 //if (typeid(stringVector)==int){
  ofstream badFile; //  declare and object as output file  using ofstream
  cout << " Illegal Vector" << endl;
  badFile.open ("hw1bout2.txt", ios::app);
  badFile << "Illegal Vector" << endl;
  badFile.close();
  return badOnes;
  }

 int i=0;
 int j=0;
 int FIRSTSIZE=stringVector.size();
 int SECONDSIZE = dict.size();
 std::string sInput="";
 std::string sDict="";

 sort(stringVector.begin(), stringVector.end());//sort() uses quicksort from the algorith library

  for(int i=0, j=0; i < FIRSTSIZE && j < SECONDSIZE; ){
   sInput=stringVector[i];

   char (*transformation_fn)(char) = &std::toupper;
   std::transform(sInput.begin(), sInput.end(), sInput.begin(), transformation_fn); //convert input word to upper

   sDict=dict[j];


   if(sInput.compare(sDict) == 0) {
   goodOnes.push_back(stringVector[i]); //write good word to vector

   i++;//advance one position in string vector
   j++;//advance one position in dictionary
    }

  else if(stringVector[i] < dict[j] && FIRSTSIZE < SECONDSIZE){// wrods did not match
   if (stringVector[i].size() >0) badOnes.push_back(stringVector[i]); //write bad word to vector if not empty string
   i++;//advance one position in string vector
   }

  else{
   j++;//advance one position in dictionary
    }
}



 return goodOnes;
}

template    
vector isWord(vector &stringVector, vector &goodOnes,vector &badOnes, vector &dict)
{

 vector strV;


 if (typeid(stringVector).name()== typeid(strV).name()){

  badOnes.push_back("Illegal Vector" );
 }
  return badOnes;

}

//template
vector  allOperations(int *** &myArray1, int *** &myArray2,  int *** &myArray3,int numberOfRows, int numberOfColumns,int numberOfDepth  )

{
    int i=0;
 int j=0;
 int k=0;

    int size = numberOfRows * numberOfColumns * numberOfDepth; //find vector size
    vector myvector = vector(size);// create a vector
    //const vector& myvector;
    //vector::const_iterator it = myvector.begin();
    vector::const_iterator it;// const_iterator is faster than iterator
    for(i = 0; i < numberOfRows; i++)
   for(j = 0; j < numberOfColumns; j++)
    for(k = 0; k < numberOfDepth; k++){

     myArray3[i][j][k] =myArray1[i][j][k]+myArray2[i][j][k];

     myvector.push_back(myArray3[i][j][k]);


    }
     return myvector;


}
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/lib/gcc/i686-pc-linux-gnu/4.5.1/../../../crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
stdout

Standard output is empty