(solution) C++ Programming Assignment Instructions: Please read below on the

(solution) C++ Programming Assignment Instructions: Please read below on the

I am in need of  C++ assignment done, which involves C-style strings and characters. Check the attachment for the complete information on the project.

C++ Programming Assignment
Instructions:
Please read below on the next pages for the complete procedure. Here is the rubric: MUST BE YOUR OWN CODE, NOT SOLUTION FOUND ONLINE Phase 1
Implement the following functions. Each function deals with null terminated C-Style strings. You
can assume that any char array passed into the functions will contain null terminated data. Place
all of the functions in a single file and then create a main() function that tests the functions
thoroughly. You will lose points if you don't show enough examples to convince me that your
function works in all cases.
Please note the following:
1. For phase 1 you may not use any variables of type string. This means that you should not
#include <string>. Also, you may not use any c-string functions other than strlen(). If you
use any other c-string functions, you will not get credit. Note, however, that functions
such as toupper(), tolower(), isalpha(), and isspace() are NOT c-string functions, so you
can use them. Also note that this prohibition is only for the functions that you are
assigned to write. You can use whatever you want in your main() function that tests them.
2. In most cases it will be better to use a while loop that keeps going until it hits a '', rather
than using a for loop that uses strlen() as the limit, because calling strlen() requires a
traversal of the entire array. You could lose a point or two if you traverse the array
unnecessarily.
3. None of these function specifications say anything at all about input or output. None of
these functions should have any input or output statements in them. The output
should be done in the calling function, which will probably be main(). The only
requirement about main() is that it sufficiently test your functions. So, you can get user
input in main() to use as arguments in the function calls, or you can use hard-coded
values — up to you, as long as the functions are tested thoroughly.
Here are the functions:
1. This function finds the last index where the target char can be found in the string. it
returns -1 if the target char does not appear in the string. The function should be case
sensitive (so 'b' is not a match for 'B'). 2. int lastIndexOf(const char* inString, char target)
3. This function alters any string that is passed in. It should reverse the string. If "flower"
gets passed in it should be reversed in place to "rewolf". For efficiency, this must be
done "in place", i.e., without creating a second array. 4. void reverse(char* inString)
5. This function finds all instances of the char 'target' in the string and replace them with
'replacementChar'. It returns the number of replacements that it makes. If the target char
does not appear in the string it should return 0. 6. int replace(char* inString, char target, char replacementChar)
7. This function returns the index in string s where the substring can first be found. For
example if s is "Skyscraper" and substring is "ysc" the function would return 2. It should return -1 if the substring does not appear in the string. This is the hardest function in
phase 1. My solution is under 10 lines, but if you find yourself going up to around 15 or
even 20 I wouldn't penalize you. 8. int findSubstring(const char* inString, const char
substring)
9. This function returns true if the argument string is a palindrome. It returns false if it is no.
A palindrome is a string that is spelled the same as its reverse. For example "abba" is a
palindrome. So are "hannah" and "abc cba".
Do not get confused by white space characters. They should not get any special
treatment. "abc ba" is not a palindrome. It is not identical to its reverse.
Your function should not be case sensitive. For example, "aBbA" is a palindrome.
You must solve this problem "in place", i.e., without creating a second array. As a result,
calling your reverse() function from this function isn't going to help. bool isPalindrome(const char* inString)
10. This function converts the c-string parameter to all uppercase. 11. void toupper(char* inString)
12. This function returns the number of letters in the c-string. 13. int numLetters(const char* inString)
Phase 2
Now implement the following two functions in the same file as your phase 1 functions, and add
statements to main() to test them. As with the phase 1 functions, these will have no output, and
only read() will have input. The purpose of this part of the assignment is to give you practice
using strlen(), strcpy(), and strcat(). For full credit you must use these functions when
appropriate. Don't use related functions such as strncpy(). This means, among other things, that
there will be no loops. You still may not use anything from the C++ string class.
Unfortunately, Visual C++ will, under its default settings, report an error when you try to use
strcpy() or strcat(), even though they are standard C++. I don't have access to VS, but I believe
that if you put the following as the first line in your file, that won't happen: #define _CRT_SECURE_NO_WARNINGS
Someone please let me know if that doesn't work.
1) void read(char*& readMe);
This function should use cin.getline() to read a c-string from the console into the parameter,
readMe. The function will stop reading when a newline character is encountered, and cin.getline()
does this. You can read about cin.getline() near the end of section 10.3 in the text (page 551 in
7th edition. Note: this is the text by Gaddis. If your class is using a different text you'll need to use the index). This read() function has a precondition that readMe is either NULL or has been
allocated using the "new" operator. (This is so that you can call "delete" on it without worrying
about whether it is uninitialized.) You are required to allocate the exact correct number of
elements for readMe that are required to store the string that the user enters, but you may
assume that the user enters no more than 80 characters.
Don't let the char*& notation intimidate you. Think of it this way. If we leave off the &, then what
we have is a parameter of type "pointer to char" that is passed by value. When we add the &, it
just means that we have a parameter of type "pointer to char" that is passed by reference. We
want pass by reference because when we change readMe inside this function, we want the
corresponding argument in the calling function to also change. One of the statements in this
function will start with "readMe = ", and if readMe was not passed by reference this wouldn't
have the desired effect of changing the corresponding argument in the calling function.
This function will be 5 lines of code:
1. Deallocate readMe, because we are going to have to allocate a new chunk of memory for
it. (Make sure you understand this point!!)
2. Declare a non-dynamic array of size 81.
3. Use getline() to read the user's input into this non-dynamic array.
4. Allocate readMe to be the correct size. You'll need "new", and strlen().
5. Use strcpy() to copy the contents of the non-dynamic array into readMe.
You'll want to test the function more thoroughly than just this, but to start with try something like
this: 2) char* mystr = NULL;
cout << "Enter a string: ";
read(mystr);
cout << "You entered: " << mystr << endl; void concatenate(char*& left, const char* right);
This function modifies left so that it is equal to the concatenation of left and right. Be careful to
allocate left to be the correct size first.