Wednesday, October 28, 2015

Input Output Process for Pascal Begginer



For my suvey, i have ask much student about how do you know program! There are many student give a testimony that program is very a new concept of technology which much contribute for student and people. So, i am aware that so many student want to understand program but don,t know what shouls they do for beginning , in this article i will tell you about beginning written program with Input Process Output in PASCAL.

Below, i will give you a simple examples that i have ever discussing with my friends in the Class

Program Examples;

USES CRT;
VAR
Name               : String [16;
Price                : longint;
Amount           : Byte;
Total                : longint;

BEGIN
Textcolor (14)             ;
TextBackGround (1)   ;
Clrscr                           ;

{INPUT of program}
Write ('Name Goods:');           Readln (Name);
Write ('Price:');                        Readln (Price);
Write ('Number:');                   Readln (Number);

{ The PROCESS }
Total: = Price * Number;

{Part OUTPUT}
Textcolor (14 + 128);
Writeln ('Total Price:', Total);

Readln;
END.

Detail program code:
The program usually can not be separated from the IPO:  
The Process Input Output
 
1. Input: aims to incorporate the data that will be processed

2. Process: aims to process data that would enter the results to be displayed

3. Output: aims to inform users the results of the processing that has been done.

On the above example at its core logic, namely:

Input Prices
Input Amount
Process Total = Price * Number
Total output

Okay more simplified re: Total = Price * Number
Perhaps it was appropriate to express the above program.

Well, let's discuss the other:
No formula A = 4 * 3 + B
Beware of how many variables are in need? Right: just two variables, namely A and B. it must be in a message at the VAR, namely:

VAR
B: Byte; so also for A
A: Byte;

The next well should you find that is where the variable and which variables PROCESS INPUT.
for a more simple, namely Variable Input variable is needed by other variables. in the above case A = 4 * 3 + B to a B do not yet know at what rate. while 4 & 3 well Right the value so it does not need to be input.
so:
we must use Readln (B); to input the value of B.

Then, IF has input B for example value: 5 then the formula should be
A = 4 * 3 + 5.
so whichever occurs first made? INPUT or PROCESS, true a course INPUT so that the program becomes:

VAR
B: Byte;
A: Byte;

BEGIN
Readln (B);
A: = 4 * 3 + B;

END.

live how USER can know information on how the value of A? then we must show the value of the variable A is writeln (A);
 
The program becomes:

VAR
B: Byte;
A: Byte;

BEGIN
Readln (B);
A: = 4 * 3 + B;
WRITE (A);
END.

if the above program in the run then it could obtain the following results:

4 -> The fed
19 -> The results of the process

Then, just past the figures appear like it, 4 and 19 really numbers what RCMS ... then we need to smarten the OUTPUT display becomes

WRITE ('VALUE B:');
Readln (B);

and

WRITE ('VALUE A:');
WRITE (A);
but usually abbreviated
WRITE ('VALUE A:', A);

Then already know WRITE command use it for anything, just simply to show results or as a User Interface only, so that we program it easier to understand.

Okay, Maybe there are questions in Part PROCESS INPUT and OUTPUT?

No comments:

Post a Comment