/***************************************************************
* Name: Rafael Orta
* Course: Computer Science & Programming
* Class: CS04103 Section: 4 & 5
* Assignment Date: 03/07/25
* File Name: Extractor.cpp
*****************************************************************
* ID: Not Applicable
* Purpose: Collects the full ame and returns only the last name
*****************************************************************/
#include <iostream>
#include <string>
using namespace std;
string extract (string);
int main()
{
// Variable Declaration
string fullName;
// Collecting Data
cout << "Enter your full name: ";
getline(cin,fullName);
// Calling the function and returning values to the screen
cout << endl << "The last name is: " << extract(fullName) << endl;
return 0;
}
// Function Definition
string extract (string fullName)
{
int pos = 0, size = 0;
size = fullName.length();
pos = fullName.find(' ');
return fullName.substr(pos+1,size);
}