Written by Al.So. Software solutions

Slides:



Advertisements
Similar presentations
IT 325 OPERATING SYSTEM C programming language. Why use C instead of Java Intermediate-level language:  Low-level features like bit operations  High-level.
Advertisements

Semantic Analysis Chapter 6. Two Flavors  Static (done during compile time) –C –Ada  Dynamic (done during run time) –LISP –Smalltalk  Optimization.
Pascal Programming Today Chapter 4 1 »Conditional statements allow the execution of one of a number of possible operations. »Conditional statements include:
Program CheckPass; var TestScore, ExamScore : integer; FinalScore : real; Status : string; begin write(‘Enter the Test score:’); readln(Testscore); write(‘Enter.
James Tam Loops In Pascal In this section of notes you will learn how to rerun parts of your program without having to duplicate your code.
A simple C++ program /* * This program prints the phrase "Hello world!" * on the screen */ #include using namespace std; int main () { cout
CS31: Introduction to Computer Science I Discussion 1A 4/2/2010 Sungwon Yang
Javascript II Expressions and Data Types. 2 JavaScript Review programs executed by the web browser programs embedded in a web page using the script element.
Mini-Pascal Compiling Mini-Pascal (MPC) language
Pascal By: Liane Tom. Outline o Background o Data types and Syntax o Procedures and Functions o Advantages o Disadvantages.
CS241 PASCAL I - Control Structures1 PASCAL I - Control Structures Philip Fees CS241.
1 Lecture 5  More flow control structures  for  do  continue  break  switch  Structured programming  Common programming errors and tips  Readings:
FOR DOWNTO Suppose you want to write a FOR-DO loop where the control variable is decreased with each repetition of the loop. Pascal provides the reserved.
The Data Element. 2 Data type: A description of the set of values and the basic set of operations that can be applied to values of the type. Strong typing:
Pascal Course Spring Introduction Designed: 1968/9 by Niklaus Wirth Published: 1970 Imperative, structural, procedural Static and strong.
 For Loops › for (variable set; condition; incremental or decrement){ // loop beginning › } // loop end  While loops › while (condition) { // beginning.
1 The CONST definition CONST Pi = , City = ‘New York’; Constant identifiers are used when you do not want the value of an identifier to change why.
2440: 211 Interactive Web Programming Expressions & Operators.
Java Data Types. Primitive Data Types Java has 8 primitive data types: – char: used to store a single character eg. G – boolean: used to store true or.
Pascal language Slides of Omar Al-Nahal. Components of Pascal Language Components of Pascal Language 1. Pascal Character set: - English Letters. - Decimal.
Selection Boolean What is Boolean ? Boolean is a set with only two values : –true –false true and false are standard identifiers in Pascal, called Boolean.
CIS-165 C++ Programming I CIS-165 C++ Programming I Bergen Community College Prof. Faisal Aljamal.
Introduction to Pascal The Basics of Program writing.
Pascal Course Spring Introduction Designed: 1968/9 by Niklaus Wirth Published: 1970 Imperative, structural, procedural Static and strong.
1 homework Due today: hw #1 (mailing list printout) readings to date: chapter 1 and chapter read appendix B (3 pages on DOS) and and.
Pascal Programming Written by Leung King Yung. Simple Program 1 begin end.
CSC1201: Programming Language 2 Lecture 1 Level 2 Course Nouf Aljaffan (C) CSC 1201 Course at KSU1.
I Power Higher Computing Software Development High Level Language Constructs.
C++ Basics. Compilation What does compilation do? g++ hello.cpp g++ -o hello.cpp hello.
Pascal Programming Arrays and String Type.
Chapter 51 Logical Operators Used with Boolean expressions Not – makes a False expression True and vice versa And – will yield a True if and only if both.
PSU CS 106 Computing Fundamentals II VB Declarations HM 5/4/2008.
Java Programming, Second Edition Chapter Two Using Data Within a Program.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
CS241 PASCAL I - Control Structures1 PASCAL Control Structures Modified Slides of Philip Fees.
Higher Computing Software Development -So Far- 5/10/10.
Values, Types, and Variables. Values Data Information Numbers Text Pretty much anything.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
Scion Macros How to make macros for Scion The Fast and Easy Guide.
Pascal Programming George Boole, a 19 th Century mathematician, is created with true, false logic. A Boolean expression in Pascal will be true or false.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
Topics for today: 1.Comments 2.Data types 3.Variable declaration.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
Midterm preview.
Basic concepts of C++ Presented by Prof. Satyajit De
Pascal Programming Arrays and String Type.
IGCSE 4 Cambridge Data types and arrays Computer Science Section 2
Visual Basic Variables
Visual Basic 6 (VB6) Data Types, And Operators
Documentation Need to have documentation in all programs
CPSC Pascal Brent M. Dingle Texas A&M University 2001, 2002
Starter Question In your jotter write the pseudocode to take in two numbers, add them together then display the answer. Declare variables RECEIVE firstNumber.
A Very Brief Overview of Pascal
البرمجة بلغة الفيجول بيسك ستوديو
البرمجة بلغة فيجول بيسك ستوديو
Introduction to C++ Programming
An overview of Java, Data types and variables
Do … Loop Until (condition is true)
Recap Week 2 and 3.
Java Programming Review 1
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
Chapter 2 Programming Basics.
2. Second Step for Learning C++ Programming • Data Type • Char • Float
The Data Element.
Variables Here we go.
C# Revision Cards Data types
The Data Element.
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Millennium High School Agenda Calendar
Variables and Constants
Presentation transcript:

Written by Al.So. Software solutions Pascal Programming Written by Al.So. Software solutions

Simple Program 1 begin end.

Simple Program 2 program Test; uses wincrt; begin writeln(‘Good Afternoon!’); end.

Simple Program 2 Results:

Reserverd Words These are the common reserved words of pascal program. You cannot use this as a variable name. begin end program var string if then else for to downto while do repeat until procedure function in

Program Title program Test; {This is the program title(you can omit it)} begin {Main Body} end.

Additional explanation Data type These are the common data type of pascal program. Type Explanation Additional explanation Example integer Whole numbers 3, 104, 0, -9 string String variable (Text) 'Hello World', '456,4' char Character (One character) 'b', 'A', '7' boolean Boolean variable Can only be True or False True, False real Real numbers (Floating point numbers) 4.0, -0.08, 48.6, 2.0E4

Declaring variable program Test; var i : integer; var s : string; var c : char; var b : boolean; var r : real; begin {Main Body} end.

Declaring variable program Test; Uses wincrt; var i : integer; s : string; c : char; b : boolean; r : real; Begin I := 0; Writeln(i); end.

Using Library program Test; uses wincrt; {Wincrt is a common library in turbo pascal for i/o manipulations wincrt.tpu} var i : integer; begin {Main Body} end.

Using Variables program Test; uses wincrt; var i : integer; Begin Readln(i); writeln(i); end.

Using Variables Results:

Using Variables program Test; uses wincrt; var i : integer; j : integer; begin i := 7; j := 3; i := i + j; writeln(i); end.

Using Variables Results:

Comparing VB with Pascal VB: Dim i as integer Pascal: var i : integer; VB: i = 10 Pascal: i := 10; VB: ‘comment Pascal: {Comment}/(*Comment*)

Comparing VB with Pascal Dim j as integer j = 10 If j = 10 then print “J = 10” Else print “J <> 10” End If

Comparing VB with Pascal Uses wincrt; var j : integer; begin j := 10; if j = 10 then writeln(‘J = 10’) else writeln(‘J <> 10’); End.

IF…THEN…ELSE program Test; var j : integer; begin j := 10; if j = 10 then writeln(‘J = 10’) {*** No “;”} else writeln(‘J <> 10’); writeln(‘End of program’); end;

IF…THEN…ELSE program Test; var j : integer; begin j := 10; if j = 10 then writeln(‘J = 10’) else writeln(‘J <> 10’); writeln(‘End of program’); end; The whole If-Phrase

Complicated IF…THEN…ELSE if i = 10 then if j = 10 then writeln(‘i = 10 and j = 10’) else writeln(‘i = 10 and j <> 10’) writeln(‘i <> 10 and j <> 10’); Correct Program

Complicated IF…THEN…ELSE if i = 10 then if j = 10 then writeln(‘i = 10 and j = 10’) else writeln(‘i = 10 and j <> 10’); writeln(‘i <> 10 and j <> 10’); Wrong semicolon (Syntax Error)

Comment begin {This is a comment} (* This is also a comment*) end.