Wednesday 28 April 2010

Operators ( Example Console Program using Delphi )

This is an example program using operators

program Using_Operators;

{$APPTYPE CONSOLE}
uses
SysUtils;

begin
   // Insert user code here
   writeln('7 + 8 = ', 7 + 8);
   writeln('7 - 8 = ', 7 - 8);
   writeln('7 x 8 = ', 7 * 8);
   writeln('15 : 3 = ', 15/3:0:0);
   { :0:0 is for formatting. You should try to ommit it }
   { and see what happend at the result }
   writeln('17 mod 4 = ', 17 mod 4);
   writeln('17 div 4 = ', 17 div 4);
   writeln('3 + 2 x 4 = ', 3 + 2 * 4); // see the different between
   writeln('(3 + 2) x 4 = ', (3 + 2) * 4); // these two expressions
   writeln(8 shr 1); // logic operator
   writeln(8 shl 1); // logic operator
   writeln(1 = 2); // boolean operator
   writeln(not (1 = 2)); // boolean operator
   writeln(7 >= 2); // relational operator
   writeln('a' < 'b'); // relational operator
   writeln('123delphicodes' = '123
delphicodes'); // string operator
   writeln('123
DelphiCodes' = '123delphicodes'); // string operator
   writeln('123
DelphiCodes' < '123delphicodes'); // string operator
   readln; // wait until enter button is pushed
end.

2 comments:

  1. makasih ya atas sharingnya kawan

    moga sukses selalu dan tetap semangat

    ReplyDelete
  2. apakah ini?
    saya tidak mengetahui arti dari ejaan rtersebut.tapi tetep saja saya komentar.wkwkwk
    maturtengkiyu sobat,sudah berbagi informasi....

    ReplyDelete

These links are part of a pay per click advertising program called Infolinks. Infolinks is an In Text advertising service; they take my text and create links within it. If you hover your mouse over these double underlined links, you will see a small dialog box containing an advertisement related to the text. You can choose to move the mouse away and go on with your browsing, or to click on the box and visit the relevant ad. Click here to learn more about Infolinks Double Underline Link Ads.