• Image 1
  • Image 2
  • Image 3
  • Image 4
  • Image 5
  • Image 6
  • Image 7




Showing posts with label PASCAL. Show all posts
Showing posts with label PASCAL. Show all posts

Sunday, September 9, 2012

LIBRARY PROGRAM WITH FOR


Hi.. Hi.. my friends.. you are on my blog at “We Are aKnowledge”… You can take many IT knowledge in here. I provided for you is IT knowledge from dekstop programming until web programming.

You must read my article for know how to method making library program using for in program language pascal. So let’s do read my article.. have fun friends to read ….

Pascal is program language based dekstop… you must to learn this program language, before you to learn other program language..
This is coding for making sample library program using for… you can copy this coding to your aplication or you also can copy to your notepad.


Example 1 :

uses crt;
var
a, b, c : integer;
d, e, f : string;
begin
clrscr;
writeln ('        Welcome In Library Program');
writeln ('This Is Sample Program Made By We Are Knowledge');
writeln ('      Sample Library Program Using For');
writeln;
writeln;
write ('Input Your Name     : ');
readln (d);
write ('Input Title Of Book : ');
readln (e);
write ('Old Lending Of Book : ');
readln (b);
c := 0;
for a := 1 to b do
c := c + 1500;
writeln;
writeln;
writeln ('Your Old Lending Of Book Is  : ', b, ' Day');
writeln ('=======================================');
writeln ('So.. You must Pay Lending Is : Rp. ', c);
readln;
end.


Attention : ::
Please change all quotes (“ “) or (‘ ‘), if you using copy paste..
And if you paste in notepad, you must change save as type become “.pas”. example library.pas.


Logic ::

Uses crt
>> the syntax is optional, you must using this if you will giving syntax “clrscr” in your coding.

Var
>> place for definition variable, a, b, c.
                Variable integer >> for to result number value
                Variable string    >> for to result character value.

Begin
>> this syntax for starting the program

Clrscr
>> for cleaning output window

Writeln
>> for printing value (character or string) to output window

Readln
>> this syntax for inputting value (character or string) in output window

End
>> the syntax for finishing thh program



Ok.. just it..
I hope you l understand..
See you later friends…

LIBRARY PROGRAM USING PASCAL


Hello my friends.. and hello IT knowledge lovers.. You now on my blog at “We Are Knowledge”.. In this blog to be found many IT knowledge and general knowledge… Yo will getting many IT knowledge in here.. like as : cobol, C ++, visual basic 6, HTML and other program language. Likely the example program language it, so I was provided web programming and dekstop programming for you…

Like this article I want giving you tutorial about program language “Pascal” and discuss of “Sample Program Library using PASCAL”.. You will know and take it from here… let’s do read my article… have fun reader for reading my article.

Ok direct to sample program… I want making libraty program. Previously you making the program, you must having the software likely “Turbo Pascal”..

You can copy this program to your software or copy in your notepad

Example 1 :

uses crt;
var
a, x : integer;
b, c : string;
begin
clrscr;
writeln ('Welcome User To My Program');
writeln (' Lets Do Try This Program');
writeln ('     LIBRARY PROGRAM');
writeln;
writeln;
a := 500;
write ('Name                 : ');
readln (b);
write ('Titles               : ');
readln (c);
write ('Old Lending          : ');
readln (x);
clrscr;
writeln ('Welcome User To My Program');
writeln (' Lets Do Try This Program');
writeln ('     LIBRARY PROGRAM');
writeln;
writeln;
writeln ('Your Name Is       : ', b);
writeln ('Titles Of Book     : ', c);
writeln ('Longer You Borrow  : ', x);
writeln;
writeln ('================================');
writeln;
writeln ('You Have To Pay    : Rp. ', x * a);
readln;
end.



Note ::

If you using copy paste, please change all quotes (‘ ‘) or (“ “).
If you copy in your notepad, please change save as become “.pas”.
For compile the program >> alt + F9
For running the program >> ctrl + F9



Logic ::

Uses crt
>> Using this syntax in order to canusing syntax “clrscr”

Var
>> Where the declaration of variables that will be used

Begin
>> Beginning of the making of the program in pascal

Clrscr
>> For cleaning the output window

Writeln
>> For printing to output window

Readln
>> for inputing value at output window

End
>> this syntax using for finishing the program pascal.


Ok.. just it..
See you later Friends..

Friday, August 24, 2012

PASCAL - TUTORIAL FILE TEXT


Hi programmer.. You are on my site in “We Are Knowledge”. In here you will getting many IT knowledge. IT knowledge based web programming likely html and php, based dekstop programming likely pascal, cobol, c++ and other program language… in here the programmer can looking for IT knowledge.

This is the right blog for begginer programmer..  because I was making tutorial from from the base to a higher level. Example if you will programmer you must learn dekstop programming and next web programming.

But now, I want giving you IT knowledge based dekstop programming. That is “program language PASCAL” and discuss about FILE in Pascal. You want to know? Let’s do read my article.. have fun for reading…

FILE

>> Files in pascal is a collection of byte-byte stored in the storage media (in pascal program). A component (an element of the file) the same data type, which is not necessarily the amount that can be reduced or increased if anyone wants to change.

Pascal files on there are some we need to know, and there are 3 types of files, namely:

1. Text file
2. files of type
3. File not type

Ok… now.. I want explain to you one by one. But I want giving you knowledge just “TEXT FILE”

1. Text file

Creating text file with pascal :

a.  Declaring a variable syntax for file
var name_variable : TEXT;

b.Linking syntax for file names with variable file
assign (name_variable, name_file);

c.  Creating a text file to be active (in use)
rewrite (name_variable);

d. Writing into a text file (edit file)
write / writeln (name_variable, value data 1, value data 2, valu data 3, and so on)

e.  closing the file
close (name_variable)


Reading Text Files with pascal

a.  Declaring a variable syntax for file
var name_variable : TEXT;

b.Linking syntax for file names with variable file
assign (name_variable, name_file);

c. Reading pascal file contents and display it in the windows or on the output window
while not eof (name_variable)
begin
readln (name_variable, value data 1, value data 2, valu data 3, and so on);
write (value data 1, value data 2, value data 3, and so on);
end;

d.  closing the file
close (name_variable)


Add the contents of the file created by pascal

assign
>> Linking syntax for file names with variable file

Append
>> additions to pre-existing file contents


Ok.. just it
I hope you likely..
See you later..

Thursday, August 23, 2012

PASCAL - SAMPLE PROGRAM SET

Hello… introduce this is my blog…. And name of “We Are Knowledge”.. you was entry previously ???...if not… I want giving you little information about this blog… My blog is place for sharing IT knowledge or general knowledge.. The IT knowledge can be web programming or dekstop programming… And for general knowledge, I was include receip Indonesian foods..

Likely this article… I want giving you IT knowledge about “PASCAL” and discuss of “SET”. Previously I was giving you IT knowledge about it.. but, now.. I want making example program using ”SET”.. you wantto know ?? let’s do read my article… have fun for reading yeahh…

This is example from using statement set in pascal… you can copy this coding in your aplication likely “turbo pascal”  or you can too copy this coding in “notepad” or “notepad++”…


Example 1 :

Uses crt;
Type kbil=set of byte;
var kabil1,kabil2 : kbil;
a,b:byte;
begin
clrscr;
writeln ('           Hello visitors');
writeln ('This is example from statement SET program');
writeln ('          survivors studied');
writeln;
writeln;
writeln ('PAGE 1');
write ('Please Input Your Number For Upper Limit : '); readln(a);
write ('Please Input Your Number For Lower Limit : '); readln(b);
kabil1 := [a..b];
writeln;
writeln ('PAGE 2');
write ('Please Input Your Number For Upper Limit :');readln(a);
write ('Please Input Your Number For Lower Limit :');readln(b);
kabil2 := [a..b];
writeln;
writeln;
if kabil1 =  kabil2 then writeln ('set on page one of each with the set on page two');
if kabil1 <> kabil2 then writeln ('set on page one is not the same as the one set on page two');
if kabil1 <= kabil2 then writeln ('set on page one member of the set on page two');
if kabil1 >= kabil2 then writeln ('set on page one have a member of the set on page two');
readln;
end.



Note :

Please change quotes likely this (“ “) or this (‘ ‘), if you using copy and paste
If  you copy in notepad or notepad ++, please save with save as type = “pas”. Ex : “set.pas”
To compile >> alt  + F9
To running >> ctrl + F9



Ok.. just it…
Have fun to learn…
See you later.

PASCAL - TUTORIAL SET


Hello hello visitors… You are in my blog on “We Are Knowledge”…You are was the right blog, and I hope you getting what do you looking for…

Likely name of my blog. In here to be found many IT knowledge, from IT knowledge deksopt programming until based web programming.. Moreover I also provided the general knowledge, likely receip Indonesian foods…

But, this time I want giving you IT knowledge about dekstop programming, that is program language “Pascal”. And discuss of “SET in Pascal”… you know previous about it… ?? if no, let’s do read my article.. have fun for reading ….

Set in Pascal is set of values ​​that have similarities - similarities in the nature, meaning that the same data type (nature) and the order of the writing does not have to be considered. Every object - the object in the set can be considered as members or elements of the set.

Example For Set :

               1.       odd number of 100 to 999
               2.       letters - letters on a computer keyboard
               3.       name - the name of the month in the calendar
               4.       four-wheeled vehicles
               5.       online games on your computer or ofline


Set the type of unstructured data contained in pascal, which is composed of several elements that have the same data type.

Set in pascal programming language similar to arrays in pasacl statement, SET is not only affected by the first element and the SET data type is no element with the same


SET declaration :

Type variabel_of_set = SET OF tipe_data;

OR

Var variabel_of_set = SET OF tipe_data;


This is example using set in PASCAL

Example1 :

Type

Word_of_set     = set of integer; {tipe dasar using type “integer”}
upper case          =‘A’..’Z’;  {subrange}
Command           = set of upper case;
moon                    = (January, February, March, April, May, June, July, august, september, october, november, december); { enumeration }
moon2                  = set of moon;
option                   = set of 1..12 {subrange in the form of numbers };


Var

lowercase           : set of ‘a’..’z’;
Capital                 :  upper_case ;
moon                    : moon2;
sentence              : word;



Ok..just it…
I hope you undesrtand with my article…
See you later friends

Tuesday, August 21, 2012

PASCAL - SAMPLE PROGRAM RECORD

Hello user… welcome to my site in “We Are Knowledge”…

Previous I was giving you IT Knowledge about “C++” and discucc of “RECORD”..

And now I want giving example program using RECORD…

You can copy this codingand paste in your aplication or paste in your “notepad”.

Example 1:

uses crt;
type product = RECORD
name_product : string[20];
sum_product : byte;
price_product : real;
total : real;
end;
var sell : array [1..10] of product;
i, j, x    : integer;
tot1     : real;
Begin
clrscr;
write ('How Many You Will Input Product : '); readln (x);
clrscr;
I := 1;
Write ('Product Name        : '); readln (sell[i].name_product);
Repeat
Write ('The Amount Of Goods : '); readln (sell[i].sum_product);
Write ('Price Of Goods      : '); readln (sell[i].price_product);
sell[i].total := sell[i].sum_product * sell[i].price_product;
inc (I);
write('Product Name        : '); readln (sell[i].name_product);
until (I = x + 1);
dec(i);
clrscr;
writeln ('------------------------------------------------------------');
writeln ('No  Product Name       quantity     Price         Total');
writeln ('------------------------------------------------------------');
for j := 1 to I do
begin
gotoxy (1, j + 3);  write (j);
gotoxy (5, j + 3);  write (sell[i].name_product);
gotoxy (17, j + 3); write (sell[i].sum_product : 10);
gotoxy (30, j + 3); write (sell[i].price_product : 10 : 2);
gotoxy (46, j + 3); write (sell[i].total : 10 :2 );
tot1 := tot1 + sell[j].total ;
end;
writeln;
writeln ('------------------------------------------------------------');
writeln ('Total :                                      ',tot1 : 10 : 2);
writeln ('------------------------------------------------------------');
readln;
end.


Note :

If last you using copy and paste, please for change all quotes (“ “) or (‘ ‘)
If  you paste in your notepad, please save with save as type = “pas”. Example = ”record.pas”.


To result :

Before you input the product you must input “how many product you will input”…

If you input number = “3” then you want input three items.
If you input number = “5” then you want input five items. And so on



Ok.. just it…
I hope you good luck…
See you later

PASCAL - TUTORIAL RECORD

Hello visitors, you are visiting in my blog, ie there “We Are Knowledge”.. maybe you will getting what do you find…

Yeah, that right in here is blog about IT knowledge. Although most about IT knowledge, but I was provided you about general knowledge likely receip Indonesian foods.

And IT knowledge I was provided is web programming and dekstop programming. And example program language like as : pascal, php, mysql, html, cobol, c++. And if you likely all about design graphic you can go to place of “adobe photoshop”.

Now, I want giving you program language “pascal” and discuss about “RECORD”. You know record in PASCAL ?? yeah, that right RECORD in pascal is Records can be considered as a set of data items, each of which has different data types from one another, but these data types can also be created equal.

Data items are elements usually called FIELD record. or FIELD is a collection of several records. Or more easely  record is the smallest part of the file. 
character >> record >> field >> file”.


DECLARATION RECORD

For the general form of a variable declaration record type is as follows:

TYPE identifier = RECORD
Name_of_field_1: type_of_record;
Nama_of_field_2: type_of_record;
Name_of_field_3: type_of_record;
Name_of_field_4: type_of_record;
..........................
..........................
name_of_field_n: type_of_record;
END;


Example 1 :

VAR  value  :  RECORD
    value_1 : integer;
    value_2 : integer;
    value_3 : integer;
    value_4 : integer;
END;



Example 2 :

TYPE  date = RECORD
    day     : 1..31;
    moon : 1…12;
    year    : 1900..2000;
END;



Example 3 :

TYPE   goods  =  RECORD
    cust_no          : integer;
    cust_type       : char;
    cust_balance : real;
    VAR  customer : goods;
END;



Example 4 :

TYPE  time = RECORD
    second     : 1..60;
    minute      : 1…60;
    hour        : 1…24;
END;


For this example using statement “array”.

Example 5 :

VAR  event1,event2 : ARRAY [1..10] OF date;



Ok… just it…
I hope you like with my article…
Don’t forget to foll back in my page…
See you later…

Monday, August 20, 2012

PASCAL - TUTORIAL POINTER

Hi.. welcome to my site in “We Are Knowledge”… In here I was provided you about many IT knowledge, from IT knowledge about dekstop programming until IT knowledge about Web programming.

Now, I want giving you IT knowledge about dekstop programming, that is “pascal” and disscus of “Using command POINTER in pascal”.. You will know, let’s do read my article… have fun and enjoy to read my article !!

Definition about Pointer

Pointer in pascal is structured data types that have been provided by the PASCAL to be made as a variable that stores the address of an object (can be variable, constants of type or subprogram).

Pointer is directions to a location data. because the pointer variable not contain data, but the address of the data

Declaration Of Pointer :

Type var_pointer : ^ identifier_tipe ;
Or
Var var_pointer : ^ identifier_tipe;


Example 1 :


Uses crt;
Type
RecordData            = RECORD
name                                : string [20];
id                        : string [15];
END;
PtrData                     = ^ Record_of_Data;

Var
mhs           : PtrData;
PtrInt        : ^Integer;
Begin
Clrscr;
End.


Pointer can also fill out the address of a variable, and the syntax is :

Var_pointer := @var_fill;


Information :

Var_pointer  = Variable pointer.
Var_fill           = Variable whose contents will be designated by the pointer.
Operator @   = This command to generate the address of the designated variable (var_fill), not the content of these var_fill.

To retrieve the contents and syntax of the data pointed to by a pointer variable (var_fill), use this:

Writeln ( var_pointer^ );

Ok this example from pointer program


Example 2 :

Uses crt;
Type
Pointerinteger = ^integer;
Var
Pointervalue : pointerinteger;
value : integer;
Begin
Clrscr;
value := 56;
Writeln ('Fill of variable value = ',value);
Pointervalue  := @value ;
Writeln ('Value of the designated = ', pointervalue^); Readln;
End.




Press ”alt  + F9” >> compile the program.
Press ”ctrl + F9” >> running the program.

NOTE ::

Please change all quotes (“ “) or (‘ ‘), if you using copy and paste…


To result ::

Fill of variable value = 56               
Value of the designated = 56


Ok just it friends....
Thanks for coming in my page..
See you later

Sunday, August 19, 2012

TURBO PASCAL -TUTORIAL FUNCTION

Hi.. welcome to my site in “We Are Knowledge”… In here you will getting many IT knowledge, because I was provided many tutorial about it.

I was provided like as :Web programming likely : PHP,HTML, Dekstop programming like as : Cobol, C++, VB 6, Pascal (I will discuss this), and other program language, and I have also provided general knowledge, like as : receip of Indonesian foods asnd Design grafis using “adobe photoshop”.

Now, I want giving you knowledge about program language “pascal”and disscus about ”Function in Pascal”. Ok.. let’s do read my article… !!

Pascal is program language based Dekstop, And has its own compiler does not like that do not have one cobol. Function in Pascal likely block procedure in pascal too. And function is program modules that produce a quantity.

Syntax :

FUNCTION name : type of result;

or

FUNCTION name (formal parameter : type ) : type of result;


Ok.. direct to program..

You can copythis and paste in your compiler likely : “turbo pascal”.

Example 1:

uses crt;

Function sum(Var A,B,C,D,E : integer): integer;
Begin
sum := A + B + C + D + E;
End;
Var K,L,M,N,O : integer;
Begin
clrscr;
Write('Value K ? ');
Readln(K);
Write('Value L ? ');
Readln(L);
Write('Value M ? ');
Readln(M);
Write('Value N ? ');
Readln(N);
Write('Value O ? ');
Readln(O);
Writeln;
writeln;
Writeln(K, ' + ',L, ' + ',M, ' + ',N, ' + ',O, ' = ', sum(K, L, M, N, O));
writeln ('Please, press enter to exit');
readln;
End.


Press ”alt  + F9” >> compille program
Press”ctrl + F9” >> running program

To result :

If you input number = “4”, ”8”, ”2”, ”1”, ”5”.


Value K  ? 4
Value L  ? 8
Value M ? 2
Value N ? 1
Value O ? 5

4 + 8  + 2 + 1 + 5 = 20
Please, press enter to exit


Note ::

Please change all quotes (“ “) or (‘ ‘).
You must aplication for making it


Thanks for visitors…
See you later..

Saturday, August 18, 2012

INTRODUCTION PASCAL

Hi.. welcome to my blog in “We Are Knowledge”… In here you will getting many IT knowledge, like as : Web programing, example : HTML and PHP. Dektop programing, example : PASCAL, 
COBOL, C++ and other program language. And general knowledge.

Now..  want giving you knowledge about dekstop programing, that is program language “PASCAL”. I want giving you introduction about it, like as : history, structures, example program, and other…

Ok.. let’s do read my article.

1.1 History of Pascal

PASCAL is program language based dekstop programming and made by Prof. Niklaus Wirth from Technical University at Zurich, Switzerland. And pascal is program high level language. Name of pascal gotten from name Blaise Pascal.


1.2 Structures Program Pascal

Structures pascal only 2 (two), that is “program title” and “program block”. And “program block” to be found, “part of declarasion” and “part of statement”.

1.2.1 Example Structures Pascal

And this is example of Pascal structures : :

User crt;
>> if you not using this, you not can using command “clrscr”

Var
>> declarasion of variable

A : integer;
B: string;
C :integer;
>> it is giving variable integer and string

Begin
>> starting in making program pascal.

Clrscr;
>> cleaning output

Readln (a);
>> for input vaiable “a”

Writeln (‘have fun in my page….’);
>> print sentence “have fun in my page….” In place of output.

End.
>> statement or command for stoping program.


2.1 About Begin

Usually programmer using more than 1 (one) “begin” … and for stoping part of begin they are using statement “end;”. Different with I (one) begin, using full stop likely “end.”..

And this example  : :

Using 1 (one) begin
Begin
End.

Using more then 1 (one) begin
Begin
Begin
Begin
End;
End;
Begin.


And this all is introduction Pascal for you…
Ok.. just it..
I hope you likely and find it…
Thanks for readers and visitors…
See you later