Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Rectangle X, Y.

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

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

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

In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
If you have come across a situation where you need to find some EDB mailbox recovery techniques, then here you will find the same. In this article, we will take you through three techniques using which you will be able to perform EDB recovery. You …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Loops Section Overview
Suggested Courses

886 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