Solved

Rectangle X, Y.

Posted on 1997-11-03
3
262 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
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to delete from listbox using edit box 6 301
TClientSocket.SendStream is slow... 2 970
TMemoryStream -> PNGImage -> TIcon convertion 22 1,257
MAPI Error1: User cancelled request ? 7 1,187
The advancement in technology has been a great source of betterment and empowerment for the human race, Nevertheless, this is not to say that technology doesn’t have any problems. We are bombarded with constant distractions, whether as an overload o…
In case you ever have to remove a faulty web part from a page , add the following to the end of the page url ?contents=1
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

820 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