Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

Program to draw a line

Posted By: Adalfrid Fischer     Category: Cobol     Views: 3446

Write a Program to draw a line.

Code for Program to draw a line in Cobol

IDENTIFICATION DIVISION.
PROGRAM-ID. Test_DRAW_LINE.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 VGA16-MODE       PIC X(10) VALUE "VGA16".
77 TEXT-MODE        PIC X(10) VALUE "TEXT".
77 STATUS-CODE      PIC X.

01 COLOURS.
   02 BLACK         PIC 9(4) COMP VALUE 0.
   02 DARK_BLUE     PIC 9(4) COMP VALUE 1.
   02 DARK_GREEN    PIC 9(4) COMP VALUE 2.
   02 DARK_CYAN     PIC 9(4) COMP VALUE 3.
   02 DARK_RED      PIC 9(4) COMP VALUE 4.
   02 DARK_MAGENTA  PIC 9(4) COMP VALUE 5.
   02 BROWN         PIC 9(4) COMP VALUE 6.
   02 LIGHT_GRAY    PIC 9(4) COMP VALUE 7.
   02 DARK_GRAY     PIC 9(4) COMP VALUE 8.
   02 LIGHT_BLUE    PIC 9(4) COMP VALUE 9.
   02 LIGHT_GREEN   PIC 9(4) COMP VALUE 10.
   02 LIGHT_CYAN    PIC 9(4) COMP VALUE 11.
   02 LIGHT_RED     PIC 9(4) COMP VALUE 12.
   02 LIGHT_MAGENTA PIC 9(4) COMP VALUE 13.
   02 YELLOW        PIC 9(4) COMP VALUE 14.
   02 WHITE         PIC 9(4) COMP VALUE 15.

77 x0      PIC 9(4) COMP.
77 y0      PIC 9(4) COMP.
77 x9      PIC 9(4) COMP.
77 y9      PIC 9(4) COMP.

PROCEDURE DIVISION.
MAIN.
   CALL "SET_VIDEO_MODE" USING VGA16-MODE STATUS-CODE
   IF STATUS-CODE = "Y"
      MOVE  50 TO x0
      MOVE 450 TO x9
      MOVE 350 TO y0
      MOVE 120 TO y9
      CALL "DRAW_LINE" USING BY VALUE x0, BY VALUE y0,
                             BY VALUE x9, BY VALUE y9, BY VALUE yellow
      ACCEPT FOO
      CALL "SET_VIDEO_MODE" USING TEXT-MODE STATUS-CODE
   END-IF
  
Share: 


Didn't find what you were looking for? Find more on Program to draw a line Or get search suggestion and latest updates.

Adalfrid Fischer
Adalfrid Fischer author of Program to draw a line is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!