Hello will someone please help!! Here is the assignment

• Using a function with the header below, pass it arguments in main, alter ary1 contents and display ary2 contents in the function definition. Display the contents of ary1 in main after the function is called.
void arrayTst(int ary1[], const int ary2[], int sizeAry1, int sizeAry2)
• Ask for, get and display a first name (with no spaces), immediately followed by ask for, get and display a full name (with no spaces).
• Implement string concatenation and assigning one string to another string.
• Implement multiple string and c-string class functions.

This is what I have so far:

#include <iostream>
#include <string>
#include <cstring>

using namespace std;

void arrayTst(int ary1[], const int ary2[], int sizeAry1, int sizeAry2);

int main ()
{
char firstName[15];
char fullName[30];
string myName = "Nicole.";

cout << "Input first name and press enter:";
cin >> firstName;
cout <<endl << "You have entered:"
<< firstName << endl << endl;

cout << "Input full name with no spaces and press enter:";
cin >> fullName;
cout << endl << " You have entered:" << full name << endl << endl;

string = string2;

cout << str1 << endl;

string::size_type len;

len = str1.length ();
cout << "str1.length () is 41? " << len << endl << endl;

Please help!!!

>>Please help!!!

Please help do what?? do you want us to do your assignment (homework)? something you don't understand about it?

I don't understand this part of it

• Implement string concatenation and assigning one string to another string.
• Implement multiple string and c-string class functions.

and I just need to know if I am going in the right direction

concantinating two std::string objects is pretty easy -- almost the same syntax as adding two integers together.

std::string s1 = "Hello ";
std::string s2 = "World";

// now concantinate s2 to the end of s1
s1 += s2;

// or if you prefer
s1 = s1 + s2;

>>• Implement multiple string and c-string class functions.
I don't know what that means either -- there must be parts of the instructions that you didn't post.

>>• Implement string concatenation and assigning one string to another string.
• Implement multiple string and c-string class functions.

I suspect you are to create your own string class and implement functions to perform concatenation and assignment. the STL string class already has concatenation, assignment, and a large variety of c-string functionality already implemented so you can use them without implementing your own. You could overload the pre-written methods, but I wouldn't recommend it as a matter of routine unless you know what you are doing.

This article has been dead for over six months. Start a new discussion instead.