Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need the program below to look like this: Here is C++ code thus far: #include <i

ID: 3622062 • Letter: N

Question

Need the program below to look like this:

Here is C++ code thus far:

#include <iostream>

#include <cstring>

using namespace std;

int main()

{

string input,FIRST,LAST,THE_NAME;

int comma,len;

cout<<"Enter last name, first name with no blanks (comma separates the two names): ";

getline(cin,input);

cout<<"As input: "<<input<<endl;

len=input.length();

comma=input.find(',',0);

FIRST=input.substr(comma+1,len-comma+1);

LAST=input.substr(0,comma);

cout<<"Your first name is "<<FIRST<<endl;

cout<<"Your last name is "<<LAST<<endl;

THE_NAME=FIRST+" "+LAST+'';

cout<<"Your full name is "<<THE_NAME<<endl;

return 0;

}

Explanation / Answer

I have made a few additions to your code provided below: u just had a few minor problems which i commented into the program as you wil see hope this helps

#include <iostream>
#include <string>

#include <cstring>

using namespace std;

int main()

{

string input,FIRST,LAST,THE_NAME;
/*if you are going to use string data types make sure to use #include <string> this is what caused all of your erors*/

int comma,len;

cout<<"Enter last name, first name with no blanks (comma separates the two names): ";

getline(cin,input);

//cout<<"As input: "<<input<<endl; //I dont think you need this according to the intructions you gave me

len=input.length();

comma=input.find(',',0);

FIRST=input.substr(comma+1,len-comma+1);

LAST=input.substr(0,comma);

cout<<"Your first name is "<<FIRST<<" and it contains "<< FIRST.length()<<" Characters"<<endl;//added everything after FIRST

cout<<"Your last name is "<<LAST<<" and it contains "<< LAST.length()<<" Characters"<<endl;//added everything after LAST

THE_NAME=FIRST+" "+LAST+'';

cout<<"Your full name is "<<THE_NAME<<endl;

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote