Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include <cab202_graphics.h> void draw_border( void ) { // (a) Declare an intege

ID: 3727591 • Letter: #

Question

#include <cab202_graphics.h>

void draw_border( void ) {

// (a) Declare an integer variable called left, with an initial value of 1.

// (b) Declare an integer variable called top, with an initial value of 1.

// (c) Declare an integer variable called right, with an initial value 0

// less than the largest visible horizontal location in the terminal window.

// (d) Declare an integer variable called bottom, with an initial value 0

// less than the maximum visible vertical location in the terminal window.

// (e) Draw a line from (left, top) to (right, top), using the '$' symbol.

// (f) Draw a line from (right, top) to (right, bottom), using the '$' symbol.

// (g) Draw a line from (left, bottom) to (right, bottom), using the '$' symbol.

// (h) Draw a line from (left, top) to (left, bottom), using the '$' symbol.

// Do not touch the following line.

show_screen();

}

int main( void ) {

setup_screen();

draw_border();

wait_char();

cleanup_screen();

return 0;

Complete the implementation of the draw_border function. This function draws a border around the inner edge of the terminal window. our task is to draw a rectangular border that frames the interior of the terminal window in a way that might be useful as part of the display for a zombie game. he border should be rendered using $ characters, and each border line should be offset from the corresponding edge of the terminal window, with displacements as below: Edge Offset Left 1 units Right units Top 1units Bottom 0 units Notes: Part marks can be obtained if you assume that the terminal window has a fixed size of 80x24 characters. However, your solution will only qualify for full marks if it works correctly on a resized window with arbitrary dimensions. ·The program should produce a display that resembles the image below. Your results will not be exactly the same as this view, because each user gets a unique set of parameters. However, it should give you an idea what to aim for. The image shown here was generated on a terminal with dimensions of 66x28 characters, left offset 3, right offset 1, and matching top and bottom offsets equal to 5 - cygdrive/c/ca6202/t2

Explanation / Answer

You cant do this line by line.....Adding line by line solution...Just uncomment & run it one by one.You cant draw this rectangle line by line...

// Draw_BorderTestPro.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <conio.h>
using namespace std;

void draw_border()
{
/* left_top to right_top
for (int i = 0; i < 120; ++i)
{
  cout << "$";
}*/

/*left_top to left_bottom
for (int i = 1; i < 120; ++i)
{

  for (int j = 1; j <= 1; ++j)
  {
   cout << "$";
  }
  cout << endl;
}*/

/*right_top to right_bottom
int i = 0;
for (int k = 1; k < 120; ++k)
{
  for (i = 0; i < 120; ++i)
  {
   cout << " ";
  }

  for (int j = i; j <= 120; j++)
  {
   cout << "$" << endl;
  }
}*/

}

int main()
{
draw_border();

_getch();
return 0;
}