1. Phép toán

1.1. Số học:

Dành cho số nguyên

 

Dành cho số thực

+, -, *, Div, Mod   +, -, *, /
– Phép chia lấy phần nguyên: DIV

– Phép chia lấy số dư: MOD

– Ví dụ: 10 div 3 = 3;        10 mod 3 = 1;

5 div 10 = 0;        3 mod 7 = 3

   

1.2. Quan hệ: <; >; <=; >=; =; < >

1.3. Logic: And; Or; Not

Chú ý:

– Kết quả của các phép toán quan hệ trả về giá trị lôgic (True hoặc False)

– Ứng dụng của các phép toán lôgic để tạo ra các biểu thức phức tạp.

2. Biểu thức số học

Chú ý: Trong một số trường hợp để tránh phải tính lại biểu thức số học nhiều lần ta nên sử dụng biến trung gian.

  • TRUNC(x)”Trả về số nguyên gần với x nhất nhưng bé hơn x.
  • INT(x)”Trả về phần nguyên của x
  • FRAC(x)”Trả về phần thập phân của x
  • ROUND(x)”Làm tròn số nguyên x
 
  • PRED(n)”Trả về giá trị đứng trước n
  • SUCC(n)”Trả về giá trị đứng sau n
  • ODD(n)”Cho giá trị TRUE nếu n là số lẻ.
  • INC(n)”Tăng n thêm 1 đơn vị (n:=n+1).
  • DEC(n)”Giảm n đi 1 đơn vị (n:=n-1).


<Biểu thức1><phép toán quan hệ><Biểu thức2>
Biểu thức quan hệ

            (?) Biểu thức1, Biểu thức 2 ở đây là gì?

Vd: a>0; a+b>c;

  • Biểu thức lôgic

Các biến logic, hằng logic và các biểu thức quan hệ liên kết với nhau bằng phép toán logic.

Vd1: “x không âm” → x>=0 hoặc Not(x<0)

Vd2:  Dùng các phép toán lôgic để mô tả biểu thức lôgic sau: “i chẵn và i chia hết cho 5 hoặc i lẻ và i chia hết cho 3”

((i mod 2 = 0) and (i mod 5=0)) Or ((i mod 2 <>0) and (i mod 3=0))

  • Câu lệnh gán

Cp: <tên biến>:=<biểu thức>;

Var delta,a,b:Integer;

x1,x2: Real;ok:Boolean;

Hãy chỉ ra những lệnh đúng, sai và lý do sai?

A. a:=sqr(b);

B. b:=sqrt(a);

C. ok:=a/b;

D. delta:=sqrt(b*b-4*a*c);

E. ok:=a>b;

F. x1:=x2 mod 2;

(?) Cho đoạn ct sau: a:=5; b:=7;

tg:=a; a:=b; b:=tg;

Sau khi thực hiện đoạn ct trên giá trị của ab lúc này bằng bao nhiêu?

3. Soạn thảo, dịch, thực hiện và hiệu chỉnh chương trình

3.1. Đối với Turbo Pascal

Để soạn thảo, dịch, thực hiện và hiệu chỉnh chương trình Pascal cần có tối thiểu các tệp:

TURBO.EXE; 2. TURBO.TPL; 3. GRAPH.TPU; 4. EGAVGA.BGI.

Một số lệnh và phím tắt thường dùng khi viết chương trình trong Pascal:

–   F2: Lưu chương trình đang soạn thảo vào đĩa.
–   F3: Mở file đã tồn tại trên đĩa để soạn thảo.
–   F4: Chạy chương trình đến vị trí con trỏ đứng.
–   Alt-F3: Đóng file đang soạn thảo.
–   Alt-F5: Xem kết quả chạy chương trình.
–   F7/F8: Chạy từng câu lệnh một trong chương trình.
–   Alt-<Số thứ tự của file đang mở>: Dịch chuyển qua lại giữa các file đang mở.
–   Ctrl-F7: Mở cửa sổ Watch theo dõi giá trị các biến.
–   Alt-F9: Dịch chương trình, sửa lỗi cho đến khi hết lỗi
–   Ctrl-F9: Chạy chương trình.
–   F10: Vào hệ thống Menu của Pascal.
–   Alt-X: Thoát khỏi Turbo Pascal.

Các thao tác trên khối văn bản

  • Chọn khối văn bản: Shift + <Các phím mũi tên>
  • Ctrl-KY: Xoá khối văn bản đang chọn
  • Ctrl-Insert: Sao chép khối văn bản đang chọn Clipboard (Ctrl+Ins)
  • Shift-Delete: Cắt khối văn bản đang chọn vào Clipboard.
  • Shift-Insert: Dán khối văn từ Clipboard vào vị trí con trỏ.

3.1. Đối với Free Pascal (Cài đặt theo hướng dẫn)


>> Còn nữa…

137 BÌNH LUẬN

  1. Hello, Neat post. There’s an issue with your site in web explorer, might check
    this? IE nonetheless is the market chief and a big component of folks will pass
    over your magnificent writing because of this problem.

  2. I do not even know how I ended up here, but I thought this post was good.
    I don’t know who you are but certainly you are going to a famous blogger if you
    aren’t already 😉 Cheers!

  3. I used to be recommended this website by means of my cousin. I am now not positive whether
    or not this submit is written by way of him as nobody else
    recognise such distinct about my problem. You are wonderful!
    Thanks!

  4. I’m impressed, I have to admit. Seldom do I encounter a blog that’s
    both equally educative and amusing, and without
    a doubt, you’ve hit the nail on the head. The issue is
    something too few folks are speaking intelligently about.

    Now i’m very happy that I stumbled across this during my
    hunt for something concerning this.

  5. Great blog right here! Also your website so much up very fast!
    What web host are you the usage of? Can I am getting your affiliate link for your host?
    I desire my site loaded up as fast as yours lol

  6. An impressive share! I’ve just forwarded this onto a
    coworker who had been doing a little research on this.
    And he in fact bought me lunch due to the fact that
    I stumbled upon it for him… lol. So allow me to reword this….

    Thank YOU for the meal!! But yeah, thanx for spending the time
    to talk about this subject here on your blog.

  7. I think this is one of the most important information for me.

    And i’m glad reading your article. But wanna remark on few
    general things, The site style is ideal, the articles is really
    great : D. Good job, cheers

  8. Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something.

    I think that you can do with some pics to drive the message home a bit, but instead of
    that, this is magnificent blog. A great read. I’ll certainly
    be back.

  9. Hi there! I understand this is somewhat off-topic however I had to
    ask. Does running a well-established blog such as yours require a massive amount work?
    I’m completely new to writing a blog but I do write in my journal everyday.
    I’d like to start a blog so I can share my experience and thoughts online.
    Please let me know if you have any suggestions or tips for new aspiring bloggers.
    Thankyou!

  10. A fascinating discussion is definitely worth comment.
    I believe that you should publish more on this issue, it might not be
    a taboo subject but generally people don’t speak
    about these issues. To the next! Best wishes!!

  11. I was recommended this blog by my cousin. I am not sure whether this post is written by him as nobody else know such detailed
    about my problem. You’re amazing! Thanks!

  12. Hey there would you mind letting me know which hosting company
    you’re utilizing? I’ve loaded your blog in 3 different web browsers and I must say this
    blog loads a lot faster then most. Can you recommend a good internet hosting provider at
    a reasonable price? Thanks a lot, I appreciate it!

  13. I believe that is among the such a lot important
    information for me. And i am satisfied studying your article.
    But wanna observation on few normal things, The web site style is perfect,
    the articles is in point of fact nice : D. Good activity, cheers

  14. You actually make it seem so easy with your presentation but I find this matter to be actually something that I think I would
    never understand. It seems too complex and extremely
    broad for me. I am looking forward for your next post, I will try to get the hang of it!

  15. Hello just wanted to give you a brief heads up and let you know a few of the
    images aren’t loading properly. I’m not sure why but I think its a linking issue.
    I’ve tried it in two different internet browsers and both
    show the same results.

  16. Hello there! Quick question that’s completely off topic.

    Do you know how to make your site mobile friendly?
    My web site looks weird when viewing from my iphone 4. I’m trying to
    find a theme or plugin that might be able to fix this issue.
    If you have any recommendations, please share. Cheers!

  17. I do not know if it’s just me or if everybody else experiencing issues with your
    website. It appears like some of the text within your posts are running off the screen. Can somebody else please comment and let me know if this is happening to them too?
    This might be a problem with my internet browser because I’ve
    had this happen previously. Kudos

  18. Aw, this was an extremely nice post. Spending some time and
    actual effort to generate a great article… but what can I
    say… I put things off a lot and don’t manage to get nearly anything done.

  19. Great goods from you, man. I have understand your stuff previous
    to and you are just extremely wonderful. I really like what you have
    acquired here, really like what you are saying and the way in which you say it.
    You make it enjoyable and you still care for to keep it sensible.
    I can not wait to read much more from you.
    This is actually a tremendous website.

  20. My programmer is trying to persuade me to move to .net from PHP.
    I have always disliked the idea because of the costs. But he’s
    tryiong none the less. I’ve been using WordPress on various websites
    for about a year and am anxious about switching to another platform.
    I have heard good things about blogengine.net. Is there a way I can transfer all my wordpress posts into it?
    Any help would be really appreciated!

  21. Hi there! This post couldn’t be written any better! Reading through this post reminds me of
    my good old room mate! He always kept talking about this.
    I will forward this post to him. Pretty sure he will have a good read.
    Thank you for sharing!

  22. Undeniably consider that which you said. Your favorite reason appeared to be at the
    web the simplest thing to be mindful of. I say to you, I certainly get irked at the same time as people consider issues
    that they plainly do not recognize about. You controlled to hit the nail upon the
    top and also defined out the entire thing with no need side-effects , other folks could take a signal.
    Will likely be again to get more. Thank you

  23. Its such as you read my mind! You seem to grasp a lot approximately this, like you wrote the e
    book in it or something. I believe that you simply
    could do with a few p.c. to drive the message house a little bit, but other than that,
    that is wonderful blog. A great read. I will certainly be back.

  24. Thanks for one’s marvelous posting! I truly enjoyed reading it, you are a great author.I will be sure to bookmark your blog and will often come back later in life.
    I want to encourage continue your great job, have a nice afternoon!

  25. It is perfect time to make some plans for the future and it’s time to be happy.

    I have read this post and if I could I want to suggest you
    some interesting things or tips. Perhaps you could write next articles referring to
    this article. I want to read more things about it!

  26. Hi there! I just wanted to ask if you ever have any trouble with hackers?
    My last blog (wordpress) was hacked and I ended up
    losing months of hard work due to no back up. Do you have any solutions to prevent hackers?

  27. Simply desire to say your article is as amazing. The clarity
    in your post is just great and i could assume you are an expert on this subject.
    Well with your permission let me to grab your RSS feed
    to keep updated with forthcoming post. Thanks a million and please
    continue the rewarding work.

  28. Howdy would you mind stating which blog platform you’re working
    with? I’m going to start my own blog in the near future but I’m having a tough time making
    a decision between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your design seems different then most blogs and I’m looking
    for something unique. P.S Sorry for getting off-topic but I had to ask!

  29. Very good blog you have here but I was curious if you knew of any community forums that cover the same topics discussed here?
    I’d really love to be a part of online community where I can get responses from other experienced individuals
    that share the same interest. If you have any suggestions, please let me know.

    Thanks!

  30. Have you ever thought about including a
    little bit more than just your articles?
    I mean, what you say is important and everything. But think of if you added
    some great photos or videos to give your posts more, “pop”!
    Your content is excellent but with pics and clips, this blog could definitely be one of the best in its field.
    Superb blog!

  31. Wonderful beat ! I wish to apprentice while you amend your website, how could
    i subscribe for a weblog web site? The account helped me a applicable deal.
    I had been a little bit acquainted of this your broadcast offered brilliant clear idea

  32. Write more, thats all I have to say. Literally, it seems as though you relied on the
    video to make your point. You obviously know what youre talking about,
    why throw away your intelligence on just posting videos to your site when you could be giving us something enlightening to read?

  33. Sorry for my English.Great blog here! Also your site loads up fast! What host are you using? Can I get your affiliate link to your host? I wish my web site loaded up as quickly as yours lol.

  34. This is really interesting, You are a very skilled blogger. I ave joined your rss feed and look forward to seeking more of your fantastic post. Also, I ave shared your website in my social networks!

  35. Wow! This could be one particular of the most helpful blogs We ave ever arrive across on this subject. Actually Wonderful. I am also a specialist in this topic so I can understand your hard work.

  36. I blog quite often and I seriously appreciate your information. This article has really peaked my interest. I’m going to book mark your website and keep checking for new information about once per week. I opted in for your RSS feed as well.

  37. Wow! This can be one particular of the most useful blogs We ave ever arrive across on this subject. Basically Excellent. I am also an expert in this topic therefore I can understand your effort.

  38. Your style is really unique compared to other people I have read stuff from. Many thanks for posting when you have the opportunity, Guess I will just bookmark this page.

  39. Wonderful blog! I found it while surfing around on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I ave been trying for a while but I never seem to get there! Many thanks

  40. Nice blog here! Also your site loads up very fast! What web host are you using? Can I get your affiliate link to your host? I wish my site loaded up as fast as yours lol

  41. I simply could not depart your website before suggesting that I really enjoyed the usual information a person supply to your visitors? Is going to be again regularly in order to check up on new posts.

THOÁT KHỎI BÌNH LUẬN

Please enter your comment!
Please enter your name here