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.

22nd Oct 2021, 7:52 AM
Shivani
Shivani - avatar
13 Antworten
23rd Oct 2021, 4:13 PM
born2code
born2code - avatar
+ 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.
22nd Oct 2021, 8:01 AM
Ipang
+ 2
Shivani, For better results, please do search the web for this, cause I don't think I can suggest you an actual solution ...
22nd Oct 2021, 9:51 AM
Ipang
+ 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.
22nd Oct 2021, 10:32 AM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar
+ 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
22nd Oct 2021, 10:40 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 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
22nd Oct 2021, 5:33 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
But I am doing a assignment where I have to use C language to do like that
22nd Oct 2021, 8:37 AM
Shivani
Shivani - avatar
+ 1
printf("\t\t\t\t%s\t\t\t\t", "hello world" ) ;
23rd Oct 2021, 3:17 PM
N. Vimukthi Dilshan Fernando
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
22nd Oct 2021, 11:32 AM
Shivani
Shivani - avatar
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
22nd Oct 2021, 11:40 AM
Shivani
Shivani - avatar