so i have this program i have to write were i first have to ask for input of a string then determine how many characters its has. then i have to ask again for more input and add the two strings together and compare if it is equal to a set char array and lastly change the string reprint it and state if its the same as the the set array "ABC" now using prototypes of c functiions but cant use them such as <cstring>'s strlen(), strcmp(), and strcpy() instead have to write the whole program using array syntax! this is what i have right now but stumped on writing the function to add the arrays together please help!
//
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
int myStrLen(constchar[]); // return length of null-terminated
// string stored in char array
void myStrCpy(char[], constchar[]); // copy the contents of the
// 2nd string into the 1st
int myStrCmp(constchar[], constchar[]); // return 0 if two strings
// are equal, else return 1
int main()
{
char text[128];
cout << "enter text: ";
cin.getline(text, 128);
char abc[] = "ABC";
cout << "String: " << text << endl;
cout << "Length: " << myStrLen(text) << endl;
return 0;
}
int myStrLen(constchar *ptr)
{
//variable used to access the subsequent array elements.
int offset = 0;
//variable that counts the number of elements in your array
int count = 0;
//While loop that tests whether the end of the array has been reached
while (*(ptr + offset) != '\0')
{
//increment the count variable
++count;
//advance to the next element of the array
++offset;
}
//return the size of the array
return count;
}
not in same class but ya i get what this guy is trying todo but I dont think it helps i need a void function using void(char[], const char[]) they are using two const chars?