A Simple Program CPSC 110 - Pascal Brent M. Dingle Texas A&M University 2001, 2002.

Slides:



Advertisements
Similar presentations
CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
Advertisements

IT151: Introduction to Programming
C Introduction Lesson CS1313 Spring C Introduction Lesson Outline 1.C Introduction Lesson Outline 2. hello_world.c 3.C Character Set 4.C is Case.
Introduction to C++ Programming. A Simple Program: Print a Line of Text // My First C++ Program #include int main( ) { cout
Introduction to C++ September 12, Today’s Agenda Quick Review Check your programs from yesterday Another Simple Program: Adding Two Numbers Rules.
C Introduction Lesson CS1313 Spring C Introduction Lesson Outline 1.C Introduction Lesson Outline 2. hello_world.c 3.C Character Set 4.C is Case.
Introduction to C Programming
Principles of Programming Fundamental of C Programming Language and Basic Input/Output Function 1.
C Programming Language 4 Developed in 1972 by Dennis Ritchie at AT&T Bell Laboratories 4 Used to rewrite the UNIX operating system 4 Widely used on UNIX.
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
 2003 Prentice Hall, Inc. All rights reserved. Customized by Sana Odeh for the use of this class. 1 Introduction to Computers and Programming in JAVA.
Java An introduction. Example 1 public class Example1 { public static void main (String [] args) { System.out.println (“This is the first example”); int.
Introduction to C Programming
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.3 The Class String.
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
Basic Elements of C++ Chapter 2.
Chapter 2 How to Compile and Execute a Simple Program.
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.
Unit 3: Java Data Types Math class and String class.
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
Copyright 1999 by Larry Fuhrer. Pascal Programming Getting Started...
Computer Programming 2 Lab(1) I.Fatimah Alzahrani.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
Week 1 Algorithmization and Programming Languages.
C++ Programming: Basic Elements of C++.
College Board A.P. Computer Science A Topics Program Design - Read and understand a problem's description, purpose, and goals. Procedural Constructs.
Recognizing PL/SQL Lexical Units. 2 home back first prev next last What Will I Learn? List and define the different types of lexical units available in.
THE BASICS OF A C++ PROGRAM EDP 4 / MATH 23 TTH 5:45 – 7:15.
Chapter 2: Introduction to C++. Language Elements Keywords Programmer-defined symbols (identifiers) Operators Punctuation Syntax Lines and Statements.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
1 Principles of Information Technology Introduction to Software and Information Systems Copyright © Texas Education Agency, All rights reserved.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Structured Programming (4 Credits) HNDIT Week 2 – Learning Outcomes Design an algorithmic solution for simple problem such as computation of a factorial,
1 More on Readln:numerical values Note: ENTER key counts sends a carriage return and a line feed to the computer definition: “white space”: space, tab,
Hello World Using C++ (L03) * Introduction C++ * Programming Style * Hello World Using C++ Hollow World Using C/C++ Dr. Ming Zhang.
Chapter 2 print / println String Literals Escape Characters Variables / data types.
 2007 Pearson Education, Inc. All rights reserved. A Simple C Program 1 /* ************************************************* *** Program: hello_world.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
11 ITI 1120 Lab # 2 Contributors: G. Arbez, M. Eid, D. Inkpen, A. Williams, D. Amyot.
Chapter 2 1.What is the difference between print / println 2.What are String Literals 3.What are the Escape Characters for backslash, double quotataions,
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
Fall 2001(c)opyright Brent M. Dingle 2001 Abstract Data Types (ADTs) Brent M. Dingle Texas A&M University Chapter 8 – Sections 2 and 3 (and some from Mastering.
Chapter 2 – part b Brent M. Dingle Texas A&M University
C++ First Steps.
The Second C++ Program Variables, Types, I/O Animation!
Definition of the Programming Language CPRL
Programming what is C++
Chapter Topics The Basics of a C++ Program Data Types
Chapter 6 JavaScript: Introduction to Scripting
Topic Pre-processor cout To output a message.
The CONST definition CONST Pi = , City = ‘New York’;
Chapter 2, Part I Introduction to C Programming
Basic Elements of C++.
Revision Lecture
Principles of Information Technology
Introduction to Scripting
More C++ Basics October 4, 2017.
CPSC Pascal Brent M. Dingle Texas A&M University 2001, 2002
Basic Elements of C++ Chapter 2.
Introduction to C++ Programming
Chapter 2: Java Fundamentals
Procedures Brent M. Dingle Texas A&M University
Chapter 2: Java Fundamentals
Comments Any string of symbols placed between the delimiters /* and */. Can span multiple lines Can’t be nested! Be careful. /* /* /* Hi */ is an example.
Simple Branches and Loops
Primitive Types and Expressions
Unit 3: Variables in Java
(c)opyright Brent M. Dingle 2001
Lexical Elements & Operators
Brent M. Dingle Texas A&M University Chapter 5 – Section 1
Presentation transcript:

A Simple Program CPSC Pascal Brent M. Dingle Texas A&M University 2001, 2002

Topics to be seen Reserved Words and Identifiers Program Body

A Program PROGRAM HowdyAll; BEGIN writeln(‘Howdy all !’); END. Simple enough? But what does it mean?

The first line PROGRAM HowdyAll; This is the program heading or program declaration. It has 3 parts: the reserved word program the name of the program – an identifier and lastly a semicolon All Pascal programs begin with a line like this.

Reserved Words Some words have a predefined meaning in Pascal that cannot be changed – these words are called reserved words. Examples of Reserved words are: PROGRAM, BEGIN and END

Standard Identifiers Other words in Pascal have predefined meanings but their meaning can be changed – these words are called standard identifiers. An example of a standard identifier is: writeln

Case (In)Sensitivity Pascal does NOT care if you use capital letters in your words. To it the words: BEGIN, BegIN, and BeGin are all the same.

Program Body The reserved words BEGIN and END mark the body of the program you just saw, back several slides. Notice the period after the END. All Pascal programs will end that way.

Writeln writeln is a procedure in Pascal. It is pronounced write-line. Inside the parentheses of the writeln is a string. A string is marked at the beginning and end with single quote marks.

The program’s output When you compile and run the program you will see the below output on the screen (note you may have to go to the user screen to see it) Howdy all !

Strings Strings are sequences of characters you want the program to treat as one object. Usually strings are composed of letters, digits, punctuation marks, spaces, and other symbols from the keyboard.

String creation To create a string place single quote marks at the beginning and end of the characters that you wish to group together. The single quote marks are called delimiters.

String examples ‘Howdy all !’ ‘Purple People Eater’

The single quote in a string To place the single quote in a string you type the single quote twice. For example: ‘Purple People Eaters don’’t exist.’ Note that don’’t is using TWO single quotes – NOT a double quote.

End of A Simple Program