?
Solved

Rectangle X, Y.

Posted on 1997-11-03
3
Medium Priority
?
278 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 150 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
Introducing Priority Question, our latest feature.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

771 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