Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help for c++ chapter on Pointers. Provided template shows function prototyp

ID: 3758394 • Letter: N

Question

Need help for c++ chapter on Pointers. Provided template shows function prototypes and variables to use to write code for each function as described in the template. Having trouble getting started...thanks in advance.

Template

#include <iostream>

// Function Prototypes=========================================================
// Do NOT change the signature of these function prototypes.
// If you do, your code will not compile with my altered main() function
// I suggest that you copy the prototypes below and then fill them in.
// ----------------------------------------------------------------------------
// Read in a line of text INCLUDING SPACES into a string.
// You may assume that the input will NOT exceed the maxLength available.
// Keep in mind that cin stops reading at a whitespace. See page 318.
void ReadString(char * c, int maxLength);

// Get the length of the string and store it in length
// Hint: How does C++ terminate a string? Look for that character!
void GetStringLength(char * c, int * length);

// PrintString - Just print the string in forward order using cout
void PrintString(char * const c);

// PrintStringBackwards - Print the string in reverse order using cout
void PrintStringBackwards(char * const c);

// Search the string for the test character. Return -1 if not found
int FindIndexOfCharacter(char * c, char testVal);

// Return a pointer to the character at the index given
char * GetValueAtIndex(char * const c, int index);

// Return the ascii integer value of the character at requested index
int GetIntegerValueOfIndex(char * c, int index);

// Print the hexadecimal value of the character at the requested index
void PrintHexValueAtIndex(char * c, int index);

// Make the entire string uppercase
void MakeUpperCase(char * c);

// Make the entire string lowercase
void MakeLowerCase(char * c);

// ============================================================================

//[BEGIN MAIN] -- Don't delete this line
int main()
{
// Use these variables to test.
// SIZE could change so make sure your code works with different sizes.
const int SIZE = 80;
char ca[SIZE];
char * pc = ca;
int fPrints = 0;
int bPrints = 0;
int lengthChecks = 0;

// Your code below
// =========================



// =========================
// Your code above

std::cout << "Press ENTER";
std::cin.get();
return 0;
}
//[END MAIN] -- Don't delete this line

void ReadString(char * c, int maxLength)
{
std::cout << "Enter a string less than " << maxLength << " characters." << std::endl;
// Your code here
// ==============================

// ==============================
}

void GetStringLength(char * c, int * length)
{

}

// You need to provide the rest of the functions
// See Function Prototypes at the top.

Explanation / Answer

code within readstring()

{ i while(*c!='')

{   lengthchecks++;

c++; }

if(maxlength<lengthchecks)

cout<<"error in input";

}

code within gettstring()

{ while(length>0)

{ cout<<*(c+length);

}

}

code for main()

{ //missing function calls

void ReadString(c,80);

void GetStringLength(c,lengthchecks);

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote