Solved

Rectangle X, Y.

Posted on 1997-11-03
3
268 Views
Last Modified: 2010-04-16
The program receives two numbers X, Y, it will writ to sqreen a rectangle of $ according to the numbers entered.
what I can not get right is the spaces between the two
column. I can only get:   $$$$$$
                          $
                          $
                          $
                          $$$$$$
Thanks for your help.

ad.
0
Comment
Question by:Libberachi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Expert Comment

by:mes
ID: 1216431
Can you be a little more specific? Do you need a procedure that draws rectangles in textmode?
0
 

Author Comment

by:Libberachi
ID: 1216432
Need to writ a program using integer numbers x, y, and while loops, the program shall be able to writ to sqreen (Alt + F5).
Thats all.

PS. A procedure that draws at text mode is welcom too.

ad.
0
 
LVL 1

Accepted Solution

by:
FuzzyLogic earned 50 total points
ID: 1216433
This question looks like homework... But nevermind.

Those procedures does not check X,Y.
The first (and simpler) procedure draws a filled rectangle.
The second procedure draws the outlines of the rectangle.

procedure WriteRectangle1(X,Y:integer);
  const
    Ch='$';
  var
    a,b:integer;
  begin;
    for a:=1 to X do begin;
      for b:=1 to Y do write(Ch);
      writeln;
    end;
  end;


procedure DrawRectangle2(X,Y:integer);
  const
    Ch='$';
  var
    a,b:integer;
  begin;
    for b:=1 to Y do write(Ch);
    writeln;
    for a:=1 to X do begin;
      write(Ch);
      for b:=1 to (Y-2) do write(' ');
      writeln(Ch);
    end;
    for b:=1 to Y do write(Ch);
    writeln;
  end;
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popular third-party chat platforms like Slack, Discord, and Telegram are just a few of the many new productivity applications that are being hijacked by cybercriminals to create command-and-control (C&C) communications infrastructures for their malw…
In this blog we highlight approaches to managed security as a service.  We also look into ConnectWise’s value in aiding MSPs’ security management and indicate why critical alerting is a necessary integration.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question