How do i show as many letters separated as i want without typing %c,a[n] like a million times?(see my code) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do i show as many letters separated as i want without typing %c,a[n] like a million times?(see my code)

https://code.sololearn.com/c9dfa9cq6y1J/?ref=app i know i have to create some sort of loop but I'm totally clueless as to how I'm gonna do that, help out a beginner here..

12th May 2018, 4:21 PM
Sayeef
5 Answers
+ 3
I made it output like your commented out printf. https://code.sololearn.com/c5Oj608IuAdb
12th May 2018, 4:58 PM
John Wells
John Wells - avatar
+ 2
int x=a.length() - 1; while(x>=0) { cout << a[x] << endl; x--; }
12th May 2018, 4:33 PM
‎ ‏‏‎Anonymous Guy
+ 2
for(int x = 0; x< sizeof(arr[]); x++){ printf(" %c \n", arr[x]); }
12th May 2018, 4:37 PM
Akib
Akib - avatar
0
akib reza is the code alright now? it doesn't seem to work :/
12th May 2018, 4:47 PM
Sayeef
0
Sayeef my ans is just an idea how you can print char arrays. Check John Wells's ans. He solved it for you.
12th May 2018, 5:14 PM
Akib
Akib - avatar