Reference no: EM13703791 
                                                                               
                                       
Program: Write a program that request a student's name in the subsequent form: lastName,firstName.
The program then converts each name to the following form: firstName lastName. Your program must read the student's entire name in a variable and must consist of a convertName function that takes as input a string, consists of a student's name, and returns the string consisting of the altered name.
Use the string function find to find the index of a ","; the function length to find the length of the string; and the function substr to extract the firstName, and lastName
This is what I have so far... I am not sure if i am doing this right or how to use the ConvertName function...
using namespace std;
int main() {
    string firstName, lastName, fullName, chgName;
    string line;
    cout << "Enter your last name and first name separeted by a comma" ;
    cin >> fullName;
    cout <<" You entered: " << fullName << endl;
     int comma = line.find(',');
    int length = line.length();
    lastName = line.substr(0,comma);
    firstName = line.substr(comma+2, length);
 }
I cannot seem to get this to work for some reason could somebody give me a code to compare and test?