#include #include using namespace std; struct StringRec { string testString; int strLength; int strSize; }; void AddChar(StringRec str, char theCh); bool CheckPal(StringRec str); int main (void) { char theCh; StringRec str; str.strSize=0; cout << "Enter a string: "; cin.get(theCh); while(theCh !='\n') { AddChar(str, theCh); cin.get(theCh); } cout <<"\n\nThe string you entered is: " << str.testString; cout <<"\nThe length is: " << str.strSize; } /** * AddChar adds one character to the string in a struct * * @param StringRec str * @param char theCh */ void AddChar(StringRec str, char theCh) { str.testString.append(1, theCh); str.strSize++; }