You'll need to include the header file string
and create a couple of variables of type string to hold the user's input for Name and friend's nameCode:#include <string>
then you'll be using the keyword cin to get user inputCode:string userName, friendName;
If you've started a CS class then your first chapter should be on cout, cin, and should possibly include some basic data types (int, double float, and probably string).
And since everyone is going to try to correct name and say it needs to be std::string, yes, I know that, and it should be, but this is a beginner computer science class. The teacher is going to have them doing
at the beginning of every project so it doesn't matter. When they get to some more intermediate programming the teacher will explain namespaces in more detail.Code:using namespace std;
And yes, you can use char* or char[] instead to hold the user input, but again, this is a beginner computer science class. Trying to explain a char* and char[] to people who don't even know what a function is is like trying to teach a cat dog tricks. It can be done, just not right now.