So I just started c just like 3 months ago so bare with me.This assignment is due tomorrow and my grade depends on this so I really could use some help!
My professor wants us to create a grid box; however, the values of the grid box are not fixed so he will be changing the values of the variables manually so no matter what value my professor puts in it should still remain the shape of a grid box. The corners of the grid box work fine so if you change the values in the calling program they will work. The problem I am having though is creating the loops for the horizontal. As you can see I have attemped to try to create the horizontal lines for the grid box but somehow I just can't seem to get it!(The position for this grid box starts at row 5 column 3. The variables 5(row),6(column),4(rows down),5(columns to the right),6(width),3(height),12(text color)
// Calling Program
Code:#include <stdio.h> #include <stdlib.h> #include "Myhead.h" #include "GridBox.h" int main() { // Heading(); ClearTheScreen(); GridBox(5,6,4,5,6,3,12); //Professor will change these values PauseTheScreen(); }Code:// Source Code void GridBox(int Row,int Col, int RowDwn,int ColRght,int Width,int Height,int Color) { int k,m,q,i; char UpperLeft[2],UpperRight[2],LowerLeft[2],LowerRight[2]; char Vertical[2],Horizontal[2]; char UpperTee[2],LowerTee[2],LeftTee[2],RightTee[2]; char Cross[2]; UpperTee[0] = 194; LowerTee[0] = 193; LeftTee [0] = 195; RightTee[0] = 180; Cross [0] = 197; UpperTee [1] = '\0'; LowerTee [1] = '\0'; LeftTee [1] = '\0'; RightTee [1] = '\0'; Cross [1] = '\0'; _settextcolor(14); 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,Col); _outtext(UpperLeft); _settextposition(Row,Col+Row+RowDwn+ColRght+Width+Height+Color); _outtext(UpperRight); _settextposition(Row+Color+Height,Col); _outtext(LowerLeft); _settextposition(Row+Color+Height,Col+Row+RowDwn+ColRght+Width+Height+Color); _outtext(LowerRight); // draw the Horizontals for ( q = 0; q < Row ; q++) { for ( k = 0; k < ColRght; k++) { for ( m = 0; m < Width ; m++) { _settextposition(Row,Width+ColRght*k+m); //top horizontal _outtext(Horizontal); _settextposition(Row+RowDwn*q,Width+ColRght*k+m); //bottom horizontal _outtext(Horizontal); } } } }



LinkBack URL
About LinkBacks
(The position for this grid box starts at row 5 column 3. The variables 5(row),6(column),4(rows down),5(columns to the right),6(width),3(height),12(text color)


