How to resolve the algorithm Hello world/Graphical step by step in the COBOL programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Hello world/Graphical step by step in the COBOL programming language
Table of Contents
Problem Statement
Display the string Goodbye, World! on a GUI object (alert box, plain window, text area, etc.).
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Hello world/Graphical step by step in the COBOL programming language
Source code in the cobol programming language
CLASS-ID ProgramClass.
METHOD-ID Main STATIC.
PROCEDURE DIVISION.
INVOKE TYPE Application::EnableVisualStyles() *> Optional
INVOKE TYPE MessageBox::Show("Goodbye, World!")
END METHOD.
END CLASS.
CLASS-ID GoodbyeWorldWPF.Window IS PARTIAL
INHERITS TYPE System.Windows.Window.
METHOD-ID NEW.
PROCEDURE DIVISION.
INVOKE self::InitializeComponent()
END METHOD.
END CLASS.
<Window x:Class="COBOL_WPF.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Hello world/Graphical">
<TextBox>Goodbye, World!</TextBox>
</Window>
*>
*> cobweb-gui-hello, using gtk-label
*> Tectonics:
*> cobc -w -xj cobweb-gui-hello.cob cobweb-gtk.cob \
*> `pkg-config --libs gtk+-3.0`
*>
identification division.
program-id. cobweb-gui-hello.
environment division.
configuration section.
repository.
function new-window
function new-box
function new-label
function gtk-go
function all intrinsic.
data division.
working-storage section.
01 TOPLEVEL usage binary-long value 0.
01 HORIZONTAL usage binary-long value 0.
01 VERTICAL usage binary-long value 1.
01 width-hint usage binary-long value 160.
01 height-hint usage binary-long value 16.
01 spacing usage binary-long value 8.
01 homogeneous usage binary-long value 0.
01 extraneous usage binary-long.
01 gtk-window-data.
05 gtk-window usage pointer.
01 gtk-container-data.
05 gtk-container usage pointer.
01 gtk-box-data.
05 gtk-box usage pointer.
01 gtk-label-data.
05 gtk-label usage pointer.
procedure division.
cobweb-hello-main.
*> Main window and top level container
move new-window("Hello", TOPLEVEL, width-hint, height-hint)
to gtk-window-data
move new-box(gtk-window, VERTICAL, spacing, homogeneous)
to gtk-container-data
*> Box, across, with simple label
move new-box(gtk-container, HORIZONTAL, spacing, homogeneous)
to gtk-box-data
move new-label(gtk-box, "Goodbye, World!") to gtk-label-data
*> GTK+ event loop now takes over
move gtk-go(gtk-window) to extraneous
goback.
end program cobweb-gui-hello.
program-id. ghello.
data division.
working-storage section.
01 var pic x(1).
01 lynz pic 9(3).
01 colz pic 9(3).
01 msg pic x(15) value "Goodbye, world!".
procedure division.
accept lynz from lines end-accept
divide lynz by 2 giving lynz.
accept colz from columns end-accept
divide colz by 2 giving colz.
subtract 7 from colz giving colz.
display msg
at line number lynz
column number colz
end-display
accept var end-accept
stop run.
You may also check:How to resolve the algorithm Polymorphic copy step by step in the Groovy programming language
You may also check:How to resolve the algorithm Sorting algorithms/Pancake sort step by step in the C programming language
You may also check:How to resolve the algorithm Tau function step by step in the Frink programming language
You may also check:How to resolve the algorithm System time step by step in the C programming language
You may also check:How to resolve the algorithm Soloway's recurring rainfall step by step in the Perl programming language