How to fill entire screen with any character in C? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
- 1

How to fill entire screen with any character in C?

I don't want infinite loop..Loop should stop when screen is filled once..What should be the condition or approach?

28th Mar 2018, 12:32 AM
Nikhar Sachdeva
Nikhar Sachdeva - avatar
6 Antworten
+ 5
When you say screen, do you mean the Terminal ? If yes : windows or unix (Linux, mac) ? If no : what graphical library do you use ? In either case you need to know the number of rows and column of your terminal or window. For this last one, you will rather need to define it according to the size of the window. Then, you'll just have to display them (adding position for the window)
28th Mar 2018, 7:27 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 5
If you want to do events like knowing when the console is redimensionned, you will need kind of an infinite loop. Console is not made for this kind of interaction either way so it will not be good and so on but it is still a fun exercise ! By the way, your IDE might not be the better place to do this kind of things, try run it in the window console
29th Mar 2018, 7:51 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 3
So it is the windows' consol : I do not know the functions to do that but you just have to calculate the size of the consol then display the good number of characters. Search in windows.h functions or on google (sorry for my lack of knowledge) you will find your answer there
28th Mar 2018, 4:57 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
You don't need to apologize here
29th Mar 2018, 1:16 AM
Nikhar Sachdeva
Nikhar Sachdeva - avatar
0
Output screen of IDE in Windows IDE-CodeBlocks
28th Mar 2018, 10:18 AM
Nikhar Sachdeva
Nikhar Sachdeva - avatar
0
I did it by checking my screen resolution and adjusting loop conditions according to that..But now it is limited to this resolution only..Even if I zoom in my Console..That gets disturbed and screen looks blank in between or after printing loop
29th Mar 2018, 4:08 PM
Nikhar Sachdeva
Nikhar Sachdeva - avatar