Here's what I would do, in pseudo code, so you can learn from it:
Code:
#include <iostream>
#include <string> //Use this for strings
using namespace std; //Makes it so you don't have to use std:: in front of a ton of commands
//Declare function prototype
string functionname(function arguments);
//The arguments are what it brings in. You'll use void there, I think
int main(){
declare a string;
string = functionname(); //That calls the function, and the string equals whatever it returns (a string)!
cout their name;
wait for a key to be pressed - Do not use system("pause")!!!
return 0 to main();
}
string functionname(arguments){
declare a string;
Ask for their name;
Get their name - getline(cin, stringname); //Where stringname is the string that the text goes into
return the string to main()
}
Cheers