Answer to Question #20155 in C++ for Jenn

Question #20155
Write a function that takes the first name and last name of a student and returns his/her full name. Write main to test the function.
Sample Input / output:
Enter your first name : Andre
Enter your last name : Wolf
Your full name is Andre Wolf.

I know that if I have that, I would use a prinft() statement and then use a scanf() statement to complete the whole code but I guess it wasn't right. Any tips?
1
Expert's answer
2012-12-07T04:05:28-0500
#include <iostream>
using namespace std;

char fname[100], lname[100];

void main(){
cout<<"Enter your first name : ";
cin>>fname;
cout<<"Enter your last name : ";
cin>>lname;
cout<<"Your full name is "<<fname<<" "<<lname<<".\n";
system("pause");
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS