Solved

Rectangle X, Y.

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Moving applications to the cloud or switching services to cloud-based ones, is a stressful job.  Here's how you can make it easier.
Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now