if you have a string that contains user String that contains first ,Second and last name construct and a new First &. last name | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

if you have a string that contains user String that contains first ,Second and last name construct and a new First &. last name

how i can write?

13th Jun 2021, 4:53 PM
علي حيدر
علي حيدر - avatar
1 Answer
- 1
#include <iostream> using namespace std; /*If you need a function*/ string Nameconstruter(string first, string second, string last){ return (first+" "+second+" "+last); } int main() {string firstName ="something"; string secondName =""; string lastName ="Last"; string all = firstName+" "+secondName+" "+lastName; cout<<all<<endl; cout<<Nameconstruter(firstName,secondName,lastName); return 0; }
20th Jun 2021, 2:44 AM
ch fi
ch fi - avatar