+ 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.!!
11 Respuestas
+ 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.
+ 7
TheChamp•921 -- finally got it - thx 4 the challenge!
https://code.sololearn.com/cs94M2j2akMB/?ref=app
+ 7
TheChamp•921 thanx a lot! I made another version a little more realistic:
https://code.sololearn.com/cp4Hdt2ZFVUt/?ref=app
+ 3
Nope Not Working!!😦
+ 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.
+ 3
Eric Oops That's A Symantic Error😐😝
I Infact Mean i-- there.
+ 3
There are plenty of C++ examples in this:
https://www.sololearn.com/Discuss/1036070
+ 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
+ 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!!
+ 2
Here's a cleaner solution:
https://code.sololearn.com/cQV3QGNnQRBN/?ref=app
0
Link to your code for people to see?
What's not working? What methods did you try?