Ok so my professor told us that he wanted us to create a box where Row, Column(shortening it using Col),Width,Height,and Color are variable.(He will be changing the values of those variables manually) So I did the box however to test to see that it will still make a perfect box no matter what numbers they are I changed the value of the original numbers I put which were (6 for Row,11 for Column,30 for Width,20 for Height,12 for Color) and now the box is a disaster please help I'm not sure how to fix it so the box will remain a box no matter what values I put!
Boss.c is the source code(which is where one can change the values of the row,height,width,column,and color of the box)
lebox.h is where the code is.
Code:
Boss.c
#include <stdio.h>
#include <stdlib.h>
#include "screen.h"
#include "lebox.h"
int main()
{
Heading();
SingleBox(6,11,30,20,12);
PauseTheScreen();
}
Code:
lebox.h
void SingleBox(int Row,int Col,int Width,int Height,int Color)
{
int k;
char UpperLeft[2],UpperRight[2],LowerLeft[2],LowerRight[2];
char Vertical[2],Horizontal[2];
_settextcolor(Color);
UpperLeft [0] = 218;
UpperRight[0] = 191;
LowerLeft [0] = 192;
LowerRight[0] = 217;
Vertical [0] = 179;
Horizontal[0] = 196;
UpperLeft [1] = '\0';
UpperRight[1] = '\0';
LowerLeft [1] = '\0';
LowerRight[1] = '\0';
Vertical [1] = '\0';
Horizontal[1] = '\0';
// CORNERS
_settextposition(Row+4,Col);
_outtext(UpperLeft);
_settextposition(Row+4,Col+30);
_outtext(UpperRight);
_settextposition(Row+24,Col);
_outtext(LowerLeft);
_settextposition(Row+24,Col+30);
_outtext(LowerRight);
// Horizontal Lines
for ( k = 0; k < 29; k++)
{
_settextposition(Width,12+k);
_outtext(Horizontal);
_settextposition(Width-20,12+k);
_outtext(Horizontal);
}
//Vertical Lines
for ( k = 0; k < 19; k++)
{
_settextposition(11+k,Height-9);
_outtext(Vertical);
_settextposition(11+k,Height+21);
_outtext(Vertical);
}
}