How to code a simple program in c or cpp language using string to print this👇(see in description) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to code a simple program in c or cpp language using string to print this👇(see in description)

Input-:pulkit soni Output-:p.soni

16th Jun 2019, 6:09 AM
Pulkit soni
Pulkit soni - avatar
2 Answers
+ 1
For c++, look up how to use substring. For C, you will need to manipulate the character array yourself. Find the position of the space -> add a period after first letter -> add space after that? -> loop through last part of character array and place those letters after the space in order. Don't forget to null terminate!
16th Jun 2019, 6:19 AM
Jackson O’Donnell
+ 1
You can maybe split the string at the spaces, then get the first item's first character, and give it a dot
16th Jun 2019, 6:16 AM
Airree
Airree - avatar