// ***************************************************************** // Author: Zhixiang Chen // Class: CSCI/CMPE 2380, Spring 2009 // Lab 2: More pointer practice // Date: January 13, 2009 // Comment: The code here is meant to be revised. // //----------------------------------------------------------------- // // This lab exercise is to practice more about pointers. // // There are some running-time bugs in this program. Try to fix the bugs. // // Compile and run your program. When everything is fine, // print your .h and .cpp files and turn them to me or the TA. // ***************************************************************** #include #include #include #include #include #include #include #include //include vector class template //define a const array size const int SIZE = 35; //class size const int COLUMN = 11; //column size #include "lab2380_2_head.h" using namespace std; int main( ) { /************************************************************************ Part A: Use pointer operation to revser a string of chars ************************************************************************/ char str[]="abcdefghijklmnopqrstuvwxyz"; //a string of letters char *ptr; //char ptr cout<<"befor calling reverse( )... " < "; //get a word cin>>tmpStr; chPtrs[j] = new char[strlen(tmpStr)]; //allocate memory for charPtr[i] strcpy(chPtrs[j], tmpStr); //copy the strin } //show the words for (j=0; j<5; j++) cout<