English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

here are the questions

A. Write a BASIC program to find the area of 5,000 triangles with white background and blue characters given that the code for white is 7and the code for blue is 1.

B. Identify the errors in the program below

cls
Rem program to find the area of a triangle
print a
color 5,6
A=L*b
Input 5,L,b,a
End.

Please after identifying the error re-write the program correctly

2007-01-04 06:46:54 · 1 answers · asked by rollyben 1 in Computers & Internet Programming & Design

1 answers

A) You should be able to write this part by using the corrected program in part B, but then add either a loop (5000 times) or a routine to read the values in from a data file instead of inputting from the keyboard.

B) Just think about the issue logically and you will get this program right. What should it do first?

- start with a remark to say what the program does
- clear the screen
- ask the user to input the values
- calculate the answer
- print out the answer
- end the program

Somewhere in there, probably before or after you clear the screen, they want you to change the color of the foreground and background.

Most developers used to prepare flowcharts to break down each step they would do int oeasy tasks. This is unfortunately a dying art.


However, many people still use what is called "pseudocode", which you use to state what you want the program to do, then you use that to decide what commands to use and in what order everything should be done. (Pseudocode is like the short statements I made on how your program should work above). You can then use the pseudocode as the remarks in the program for the complicated stuff.

2007-01-04 06:53:42 · answer #1 · answered by SteveN 7 · 0 0

fedest.com, questions and answers