0
How we can allign and print the any statement in middle of the page using C ?
I am writing the code using C language but I am not able to use and operator to allign in middle of the page like I want to print "hello world" in middle of the compiler which operator I use .\n is used for new line like what is used for this.
13 Réponses
+ 3
Shivani this code may helpful :)
https://code.sololearn.com/c1tACaP9P59N/?ref=app
+ 5
It's rather difficult to print string at the center of the console screen because centering calculation involves length of string, number of character per console screen line, and most importantly, the font used in the console screen.
Even if you find a way to center a string in your console screen; if you run the code somewhere else, things may look different due to use of different font.
+ 2
Shivani,
For better results, please do search the web for this, cause I don't think I can suggest you an actual solution ...
+ 2
Martin Taylor
Lol!
Being Indian doesn't mean that he is using turbo c++.
I know that you are pissed of by turbo c questions asked by indians.
But almost everyone doesn't search anything by themselves because of educational system in schools. Not just in India.
If they were teaching Turbo c in schools of England just like indian schools, then you will also encounter same problem with these students too.
+ 2
As per my knowledge in c cpp their is no standard function or method available which allow you to format your text in center . One function gotoxy () which allow to do this but its not standard function . In cpp we have manipulators which allow to do that or you can use string literals but you asking for c you can use \n and \t and some other formaters to do this
+ 2
You need not to worry noone will se your formatting just implement your logics its better to print asterisk or any other symbols instead of \t or \n
+ 1
But I am doing a assignment where I have to use C language to do like that
+ 1
printf("\t\t\t\t%s\t\t\t\t", "hello world" ) ;
0
First I am not using turbo C I am using dev C or visual studio code for program
And If I am a indian it's doesn't mean that I am using old version for coding
0
I am asking for sequence like \n, \t that's why I gave an example in description I am not sure which sequence is used because i forgot the think in C , their is a gap of 2 year that's why I am again started learning in C