156k views
2 votes
Create a function called firstName which will extract the first name from a provided full name. Assume that the provided name will follow the form; "first last" Write a script that prompts the user for their full name and uses your function to print the first name to the terminal.

User PemaGrg
by
8.0k points

1 Answer

5 votes

Answer:

#include <iostream>

using namespace std;

char name[50];

int main()

{

cout << "Please enter your name: ";

cin >> name;

cout << "Your name is: " << name << endl;

}

Step-by-step explanation:

User QuadX
by
8.2k points