Visual Logic Instructions and Assignments

Only available on StudyMode
  • Topic: Imperative programming, For loop, Control flow
  • Pages : 18 (5177 words )
  • Download(s) : 258
  • Published : April 27, 2011
Open Document
Text Preview
Visual Logic can be installed from the CD that accompanies our textbook. It is a nifty tool for creating program flowcharts, but that is only half of the story. Until this software came along, flowcharts were static diagrams that outlined the flow of execution of a computer program. When a Visual Logic flowchart is done, you can run the program “behind” the flowchart. This is a great learning resource for budding programmers. You can even create interactive programs that allow the user to input values for variables at runtime. Visual Logic is a terrific tool for grasping basic programming concepts such as variables, operators, expressions, branching, and looping. It is excellent preparation for more sophisticated programming with Visual Basic.NET. We hope you like it! Install Visual Logic on your home PC by accepting all defaults in the installation wizard. Then, put the CD away in a safe place.

Once installed, Visual Logic can be started in the usual
way from the Windows Start menu. On the “splash
screen” shown here, click on “Continue” to produce the starting flowchart. The starting
flowchart displays a “Begin” and “End”
symbol as shown. To create a flowchart,
you add symbols between these starting
Lesson One : Sample Visual Logic Program
( perform the actions that are in boldface )
Hover your mouse over the red arrow between the Begin and
End symbols. It will turn green, indicating that you can click on it to get a popup window. This popup window has the other symbols we will need to create programs.
Click on the green arrow and select the Output symbol.
This inserts the Output symbol into the
flowchart as shown. The Output symbol produces
output on the display screen. Next, we will
specify what the program should output.
Double click on the Output symbol to get the
Output dialog box.
Output that consists of a
text message must be
enclosed in quotes. This
is called a string.
The button in the lower left corner of the Output dialog toggles between More >> and reveals that there are 3 Output types. For now, leave the type as “Dialog Box” as shown.
Enter your own name and be sure to enclose it within quotes. Later, we will use variables that don’t use quotes. Click on the “OK” button when done, and the Output symbol will change to show your intended output.

Run the program by clicking on the button on the toolbar, or by pressing the F5 function key.
Your name should appear in a popup dialog box as shown above on the right. If you got red error windows like the one on the left, you likely forgot one, or both, quotes. We all do this now and then but, no problem, it’s easy to debug. Just close the error windows, double click on the Output symbol, and add

the quotes around your name. Run it again
and it should work fine.
Click on the green arrow below the first Output symbol to add another Output symbol. Make this second Output generate the
output “Visual Logic is fun”.
Run the program again. Did you remember the quotes? You should get two popup dialogs, one after the other.
Edit the first Output by clicking the More >> button. Select “console”. An odd looking “line feed” symbol, §, will be appended to your name. This is normal for console output. Summary
• Text output must be enclosed within quotes
• The More>> and to expand the window.
Inputs are special because they enable a user to
enter data when the program runs. Inputs require you
to specify a variable name and a prompt.
The prompt will inform the user of the expected
input, and the variable will accept and hold what the
user enters. Complete the Input as shown.
Insert another Input below the first Input.
Configure this Input to ask a user for his/her age
as shown. Pay attention to the case of your variable
names. These names follow the variable naming
convention used in Visual Basic.
NOTE: If you forget to specify a prompt in an Input, Visual Logic will supply a generic prompt that is not very user friendly. Avoid...
tracking img