How can i arrange..my given input(for example a name.) into seperate alphabet.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

How can i arrange..my given input(for example a name.) into seperate alphabet..

For Example:: If I put my name as:: aryan I want output as: //output a r y a n //end of output I tried making an array for the character to store alphabets of name step by step but it didn't work... Could anyone help me for writing code for this..

2nd Oct 2017, 11:08 AM
Omkar Tripathi
Omkar Tripathi - avatar
10 Answers
+ 13
Here We Go Aryan ! #include <iostream> #include <string> using namespace std; int main() { string str = "Aryan"; for (const auto &i : str) cout << i << endl; }
2nd Oct 2017, 12:01 PM
Babak
Babak - avatar
+ 13
Finally, you KILL me, man! :D #include <iostream> #include <string> using namespace std; int main() { string str = ""; cout << "What's your name?! "; cin >> str; for (const auto &i : str) cout << i << endl; }
2nd Oct 2017, 12:16 PM
Babak
Babak - avatar
+ 12
I'm just kidding. I'm here to help all of you without any expectation. Thank you. @~)~~~~
2nd Oct 2017, 12:43 PM
Babak
Babak - avatar
+ 10
So give me some motivation to help people! Next time I cut a deal with you before answering! ;D
2nd Oct 2017, 12:20 PM
Babak
Babak - avatar
+ 6
@ Babak Sheykhan(PERS).. you don't need motivation bro.. you already have the perfect attitude in yourself and I believe you will be a very great developer in future..
2nd Oct 2017, 12:29 PM
Omkar Tripathi
Omkar Tripathi - avatar
+ 5
Now that's what I wanted..😁😁 Thanks man!!👌👌
2nd Oct 2017, 12:18 PM
Omkar Tripathi
Omkar Tripathi - avatar
+ 4
Embed your code here so people can see your problem snd offer solution. (Edit) Sorry for double post, SL said my first failed, turned out it succeeded.
2nd Oct 2017, 11:18 AM
Ipang
+ 4
Thanks.. but I want the string as input nt fixed.. how can I make it variable so anybody who puts name or any word it can give desired result.
2nd Oct 2017, 12:05 PM
Omkar Tripathi
Omkar Tripathi - avatar
+ 4
@ Ipang ..Thanks
2nd Oct 2017, 12:07 PM
Omkar Tripathi
Omkar Tripathi - avatar
2nd Oct 2017, 12:24 PM
karthik
karthik - avatar