+ 5

By Default C++ Prints From Left to Right.

Right So By Any Way Is It Possible To Print Characters Right to Left Like After Some Some Space It Prints Firsts Character and Then Shifts towards Left By One Unit And prints Another Character. I'm Just Curious To Know-Thanks For Answering.!!

8th Apr 2018, 10:42 AM
™TheChamp921
™TheChamp921 - avatar
11 odpowiedzi
+ 6
if I understand correctly, you want output to appear as if the spaces are increasing RT to LFt? first of all, the reason it didn't work is bcz you have "for" loop conditions not correct. You meant to go from i=4 to i=1 but you incremented instead of decremented (i--). second, I think this can also be done incrementing from i=0 to i<4; i++, and in the output: setw(4-i). The spaces will decrease LFT to RT as i increases. Don't forget #include <iomanip> and also specify (once) which side of column you want number to be: cout<<left; or cout<<right; Hope this helps.
9th Apr 2018, 12:07 AM
Eric Zatarack
Eric Zatarack - avatar
+ 7
TheChamp•921 -- finally got it - thx 4 the challenge! https://code.sololearn.com/cs94M2j2akMB/?ref=app
9th Apr 2018, 12:11 PM
Eric Zatarack
Eric Zatarack - avatar
+ 7
TheChamp•921 thanx a lot! I made another version a little more realistic: https://code.sololearn.com/cp4Hdt2ZFVUt/?ref=app
9th Apr 2018, 1:09 PM
Eric Zatarack
Eric Zatarack - avatar
+ 3
Nope Not Working!!😦
8th Apr 2018, 12:32 PM
™TheChamp921
™TheChamp921 - avatar
+ 3
@Xan Thanks For Your Time I Tried Using Set() but not working. (EDITED) See i did this:- for(int i=4;i<0;--i) cout<<setw(i)<<"4"; and the output was:------😦 ____4___4__4_4 and what i was expecting 4444 //4 is just an example i was working with different nums.
8th Apr 2018, 6:41 PM
™TheChamp921
™TheChamp921 - avatar
+ 3
Eric Oops That's A Symantic Error😐😝 I Infact Mean i-- there.
9th Apr 2018, 7:39 AM
™TheChamp921
™TheChamp921 - avatar
+ 3
There are plenty of C++ examples in this: https://www.sololearn.com/Discuss/1036070
9th Apr 2018, 5:07 PM
John Wells
John Wells - avatar
+ 2
https://stackoverflow.com/questions/29745145/how-to-print-by-output-from-the-right-hand-side-of-the-screen-instead-of-the-usu?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
8th Apr 2018, 10:49 AM
Emma
+ 2
Looks like You Didnt Got Me Erik Your Code Has Some Ouput Like:- E____D___C__B_A What I Want:--- EDCBA Cmon....Anyone!!
9th Apr 2018, 8:20 AM
™TheChamp921
™TheChamp921 - avatar
9th Apr 2018, 1:49 PM
Emma
0
Link to your code for people to see? What's not working? What methods did you try?
8th Apr 2018, 12:33 PM
Emma