#include "CST116F2021-Lab5(Header).h" //10a //9.4 Learn by Doing Exercises //function getName definition //void getName(char first[], char last[]) //{ // cout << "Please enter your first name: "; // cin >> first; // cout << "Please enter your last name: "; // cin >> last; //} //function formatName definition //void formatName(char first[], char last[]) //{ //defining local array and counter variable // char fullName[32] = {}; // int letterCount = 0; // int letterCountOffset = 0; //copy first to fullName character by character // while (last[letterCount] != '\0') // { // fullName[letterCount] = last[letterCount]; // letterCount++; // letterCountOffset++; // } //add comma and space to fullName after first // fullName[letterCount] = ','; // letterCount++; // letterCountOffset++; // fullName[letterCount] = ' '; // letterCount++; // letterCountOffset++; //copy last to fullName character by character // while (first[letterCount-letterCountOffset] != '\0') // { // fullName[letterCount] = first[letterCount-letterCountOffset]; // letterCount++; // } // cout << fullName; //} //10b //9.5 Learn by Doing Exercises //function getStrings definition void getStrings(char firstString[], char secondString[]) { //get firstString cout << "Please enter your first string (at least six characters)\n"; cin >> firstString; //get secondString cout << "Please enter your second string (at least six characters)\n"; cin >> secondString; } //function compareStrings definition void compareStrings(char firstString[], char secondString[]) { //comparison for (int count = 0; count < 5; count++) { if (firstString[count + 1] == '\0' || secondString[count + 1] == '\0') { //error message cout << endl << "ERROR: both strings must be at least six characters.\n"; return; } } for (int count = 0; count <= 5; count++) { if (firstString[count] != secondString[count]) { //different message cout << endl << "The first six characters of your two strings are different.\n"; return; } } //same message cout << endl << "The first six characters of your two strings are the same\n"; return; }