/******************************************************************************************* Name of Program: String Manipulator v1.0 Name of file: Question3.cpp What the program does: Reads in a string and performs string copy and concatenation using both array subscripting and pointer/pointer arithmetic Creator Name: Tom Kralidis Date: December 10, 1998 Miscellaneous: Uses user entered strings to perform the above. Forgive the verboseness of the variables, they helped in keeping things clear. *******************************************************************************************/ #include #include #include //function prototypes void proc1 ( char UserEnteredWord[80] ); void proc2 ( char *WordPointer ); void proc3 ( char UserEnteredWord[80], int lengthofWord ); void proc4 ( char *WordPointer, int lengthofWord ); void proc5 ( char UserEnteredWord[80], char NewWord[80] ); void proc6 ( char *WordPointer, char *NewWordPointer ); void proc7 ( char UserEnteredWord[80], int lengthofWord, char NewWord[80] ); void proc8 ( char *WordPointer, int lengthofWord, char *NewWordPointer ); int main (void) { char UserEnteredWord[80], *WordPointer; char NewWord[80], *NewWordPointer; char UserDecision; //utilized for end of program looper int ReStart = 1,lengthofWord; WordPointer = UserEnteredWord;//making live pointers NewWordPointer = NewWord; while (ReStart) //satisfied until user prompts to exit the program { clrscr(); UserEnteredWord[0] = NULL; //clearing memory of word and its length lengthofWord = 0; cout << "Key in your favourite word\n" << endl; cin >> UserEnteredWord; cout << "\n\n"; lengthofWord = strlen(UserEnteredWord); lengthofWord += 1; //user input done, function calls follow proc1(UserEnteredWord); proc2(WordPointer); proc3(UserEnteredWord,lengthofWord); proc4(WordPointer,lengthofWord); proc5(UserEnteredWord,NewWord); proc6(WordPointer,NewWordPointer); proc7(UserEnteredWord,lengthofWord,NewWord); proc8(WordPointer,lengthofWord,NewWordPointer); cout << "\nContinue?\n\t[Y] Yes\n\t[N] No\n\t" << endl; cin >> UserDecision; if (UserDecision =='y' || UserDecision == 'Y' ) ReStart = 1; else if ( UserDecision =='n' || UserDecision == 'N') ReStart = 0; } clrscr(); cout<<"\n\nTom Kralidis\ttommy@storm.ca\n\n"<