|
|||
Plus SignCreate a program that draws a plus sign to the output. The plus sign consists of 9 pixels ordered in 3 rows and 3 columns. 4 pixels in the corners belong to the background, the others belong to the foreground. The program should use the console, where each pixel is represented by a single character. The background is represented by a dot, the foreground is represented by a lowercase “x”. Input SpecificationThe input consists of two lines, each terminated by a newline character. The first line contains the width, the second line contains the height of a pixel measured in characters. Both of those numbers are between 1 and 10. Sample Input
Output SpecificationThe output contains 3 * height lines, each containing 3 * width characters and being terminated by a newline character. Output for Sample Input
Hints and GuideThe output must be generated line by line, hence, if you are planning to use iterations embedded into each other, then the outer one must generate the lines (as the rows of the image). To make the algorithm flexible, we suggest you to create a two-dimensional array containing the picture: the characters of the plus sign with 3 rows and 3 columns. The method to draw the array to the output is now straightforward. To enlarge the picture, you have to draw each line “height” times, and each character in the line “width” times. One possible solution is available in: main.c.
Acknowledgement
This work was supported by the construction EFOP-3.4.3-16-2016-00021. The project was supported by the European Union, co-financed by the European Social Fund.
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |