Ugh I'm totally not getting my C++...I have this assigment and its already a day late...can anyone help me out?
Here are the requirements:
Using a function with this header and data types (include function prototype):
void arrayTst(int ary1[], const int ary2[], int sizeAry1, int sizeAry2)create a program that:
Passes arguments from main to the function. (Arrays are loaded with values in main).
Alters the contents of ary1 (in the function definition) and returns the data to main() to be displayed.
Displays ary2 contents in the function definition.
Displays the contents of ary1 in main after the function is called.
I think I have this covered:
Using both c-strings and the string class, ask for, get and display a first name (with no spaces), immediately followed by ask for, get and display a full name (with a space between first and last name).Using both c-strings and the string class, implement string concatenation, copying or assigning one string to another string, determining string length. Display the results of doing each.
Here are the requirements:
Using a function with this header and data types (include function prototype):
void arrayTst(int ary1[], const int ary2[], int sizeAry1, int sizeAry2)create a program that:
Passes arguments from main to the function. (Arrays are loaded with values in main).
Alters the contents of ary1 (in the function definition) and returns the data to main() to be displayed.
Displays ary2 contents in the function definition.
Displays the contents of ary1 in main after the function is called.
I think I have this covered:
Using both c-strings and the string class, ask for, get and display a first name (with no spaces), immediately followed by ask for, get and display a full name (with a space between first and last name).Using both c-strings and the string class, implement string concatenation, copying or assigning one string to another string, determining string length. Display the results of doing each.
Code:
#include <iostream> #include <string> using namespace std; int main() { char firstName[15]; char fullName[30]; 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:" << fullName << endl << endl; return 0; }
Comment