300580 Programming Fundamentals - SCEM Staff Linux...
Transcript of 300580 Programming Fundamentals - SCEM Staff Linux...
![Page 1: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/1.jpg)
1
300580
Programming
Fundamentals
With C++
1
Intro to Programming and Computer Systems Architecture
![Page 2: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/2.jpg)
2
Contact Details
� Name: Zhuhan Jiang
� Office: ER 1.04, Parramatta campus
� Telephone: 9685 9336
� Email: [email protected]
� Unit Homepage: vUWS at
http://vuws.uws.edu.au/
![Page 3: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/3.jpg)
3
Assessments
� Practical Attendance/Performance: 15%
� 9 marks for 9 tuts/pracs
� 6 marks for practice quizzes
� detailed marks breakdown in each prac page
� Assignment 1: 10%
� Assignment 2: 15%
� Mid Semester Test: 10%
� Final Examination: 50%
� Closed book
![Page 4: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/4.jpg)
4
Textbooks
� Bronson, G.J., (2006) A First Book of C++ From Here to There, 3rd Ed, Thomson Learning
� Or: Bronson, G.J., (2012), A First Book of C++, 4th Ed, Thomson Learning.
� Robertson, L.A., (2007) Simple Program Design, 5th Ed, Thomson Learning (this book is for optional reading).
� Most of the tutorial/practical exercises will be taken from this Bronson’s book
![Page 5: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/5.jpg)
5
1stYear Unit Specials
� How to use� unit learning guide, vUWS site, online library links, 1st
year coordinator, support services?
� What’s done in response to SFU etc?� While some changes may be in response to the student feedback in the past, a great many of others are also introduced for the further improvement of this unit.
� Some of the improvements� More drilling and examples on the basics – including flowcharts and code walking; More animation effects to present lecture material; Further narrowing on the coretut/prac exercises; Free access of online exercise drills; Free additional videos on basic programming; Additional sample assignments and their solution hints; More effective class structure and assessment format on tutorial/prac classes; More concrete approaches/styles to assignments; Clearer guide on expectations on different grades of different assessments
![Page 6: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/6.jpg)
6
Unit Web Site
� vUWS at http://vuws.uws.edu.au
� Register a permanent password for the unit (not the same as SCEM account)
� Check regularly the unit announcements (at least twice a week)
� Read unit outline and learning guide there
� First practical starts in the second week (for tutorial enrolment problems, contact [email protected])
![Page 7: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/7.jpg)
7
How to find
the relevant
information
or material?
![Page 8: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/8.jpg)
8
� Lecture notes are to give a relatively more concise coverage on the most important aspects of this unit
� Lecturers may selectively concentrate on the more critical aspects of the notes during the class, and thus may leave some slides to be studied by the students themselves
![Page 9: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/9.jpg)
9
What Is a Computer System?
A computer system is a device of performing computations and making logical decisions. It consists of hardware devices and software components
![Page 10: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/10.jpg)
10
Hardware:von Neumann Model
CPU
Main
Memory
Output
Devices
Input
Devices
Secondary
Memory
keyboard,
mouse
scanner
microphone
hard disks
floppy disks,
tapes
CD-ROMs
display screen,
printer
speakers
![Page 11: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/11.jpg)
11
CPU: Central Processing Unit
� Perform arithmetic calculations using the Arithmetic/Logical Unit (ALU)
� Decode and execute instructions under the control unit
ALU
Control
Unit
Instruction(Input)
Result(Output)
![Page 12: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/12.jpg)
12
The Motherboard
CPU
main memory
expansionslots
![Page 13: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/13.jpg)
13
Secondary Storage
� Floppy/hard disks
� CD ROM
� Tapes
� Smart cards
� Memory sticks
� ...
![Page 14: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/14.jpg)
14
Peripherals
� A peripheral is a device attached to a host computer but not part of it
� its primary functionality is dependent upon the host
� can be considered as expanding the host's capabilities, while not forming part of the system's core architecture
StorageInput deviceOutput deviceDisplay deviceGraphical output device…
![Page 15: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/15.jpg)
15
Bus in Computer Architecture
� is a subsystem that transfers data between computer components inside a computer or between computers
Bus card slots
a traditional 32-bit PCI bus card slot
![Page 16: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/16.jpg)
16
Evolution of Computershttp://www.computersciencelab.com/ComputerHistory/History.htm
Abacus about 1500BC Pascal's Adder 1642 Leibniz's calculator 1670sBabbage's difference
engine 1822
ENIAC 1946
(1st generation)IBM PC 1977
(4th generation)
![Page 17: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/17.jpg)
17
Computer Programs and Programming
� Computer program:
� Uses data and instructions to operate a computer
� Programming:
� Writing computer program in a language that the computer can respond to and that other programmers can understand
![Page 18: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/18.jpg)
18
Programming Language
� Set of instructions, data, and rules used to construct a program
� High-level languages use human language type instructions
� Low-level languages use instructions tied to a computer type
![Page 19: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/19.jpg)
19
Hierarchies of Programming Languages
� High-level languages:easy for humans to read/write programs, but too complicated for the computer to understand
Z = X + Y
� Machine Language: written in the form of 0’s and 1’s, can be understood directly by the computer
0110 1001 1010 1011
� Low-level languages:consist of simple instructions understood by the computer after a minor translation
ADD X Y Z
![Page 20: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/20.jpg)
20
Procedural Programming Languages
� Instructions are used to create self-contained units (procedures)
� Procedures accept data as input and transform data to produce a specific result as an output
� Initially, high-level programming languages were predominately procedural
![Page 21: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/21.jpg)
21
Typical Programming Languages
� High-level programming language:
� C, C++, Java, Python, PHP, Basic, Fortran, Pascal, Haskell, Ada
� Low-level programming language:
� Macro Assembler
� Machine language:
� Machine-dependent languages
![Page 22: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/22.jpg)
22
Software:The intangible part of the computer
� System software: programs that support the execution and development of other programs� Operating systems
� Translation systems
� Application software� Programs designed to perform specific tasks
![Page 23: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/23.jpg)
23
Operating Systems
� Control and manage the computing resources
� Important services that an operating system provides� File system: Directories, folders, files…
� Commands that allow for manipulation of the file system: Sort, delete, copy…
� Perform input and output on a variety of devices
� Management of the running systems
� Typical operation systems� Windows (7, Vista, XP), Linux, Unix, Mac OS, MS-DOS, and etc
![Page 24: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/24.jpg)
24
Program Translation
� Source program cannot be executed until it is translated into machine language� Interpreted language:translates one statement at a time - interpreter
� Compiled language:translates all statements together - compiler
TranslationProgram
C++ language source program
Machine language program
![Page 25: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/25.jpg)
25
Translation Systems
� Translation System: set of programs used to develop software
� Integrated Development Environment (IDE): Performs compilation, linking, and other activities in the same environment
� Examples: � Visual C++, Borland C++, Visual J++, JBuilder, Dev-C++, CodeBlocks C++
![Page 26: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/26.jpg)
26
Application Software
� Application software is the software that has made using computers indispensable and popular
� Common application software…� Word processors
� Desktop publishing programs
� Spreadsheets
� Presentation managers
� Drawing programs
![Page 27: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/27.jpg)
27
Stored Program Concept
Program Instructions can be stored in Main Memory just as data can.
-- Von Neumann's idea
Program Instructions can be stored in Main Memory just as data can.
-- Von Neumann's idea
![Page 28: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/28.jpg)
28
Input:
Data and
Instructions
Output:
Data
Main Memory
10110111
01101001
00110100
…
…
00110111
11101001
01110100
…
…
Bus
CPU
Control
Unit
ALU
Program
Counter
10110111
01101001
00110100
01111101
11100000
…
PC
Von Neumann’s Machine Model
Fetch an instructionfrom the memory cellwhere the PC points
Increment the PC
Decode the instruction
Execute the instruction
![Page 29: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/29.jpg)
29
Memory Allocation (1 Possible Case: DOS)
BIOSBIOS (stored in ROM)
FREEFREE (Unused)
DATA SEGMENTDATA SEGMENT
CODE SEGMENTCODE SEGMENT
OPERATING SYSTEMOPERATING SYSTEM
MemoryMemory
addressaddress
lowlow
highhigh
STACK AREASTACK AREA
![Page 30: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/30.jpg)
30
Arithmetic/ Logic Unit
Control Unit
…
R0
R1
Rn
CPU
BUS
registers
Registers are used to hold the data immediatelyapplicable to the operation at handMain memory is used to hold the data that will be needed in the near future.Secondary storage is used to hold data that will be likely not be needed in the near future.
Main Memory
Input devices
Output devices
SecondaryStorage
![Page 31: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/31.jpg)
31
Processing a High-Level Language Program
Editor Compiler Linker
Library
Executable Execution
Program source code
![Page 32: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/32.jpg)
32
The main Function .
� Each C+ program must have one and only one function named main
� Called a driverfunction because it drives the other modules
main
1st module
2nd module
3rd module
last module
You go first
I’m done
You go second
I’m done
![Page 33: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/33.jpg)
33
The main Function ..
� First line of function is called header line
� What type of data, if any, is returned from function
� The name of function
� What type of data, if any, is sent into function
� Data transmitted into a function at run time are referred to as arguments of the function
![Page 34: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/34.jpg)
34
main Function Composition
int main ( )
{
program statements here
return 0;
}
the function name an empty argument list
type of returned value
the function body
![Page 35: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/35.jpg)
35
The cout Object
� The cout object sends data to the
standard output display device
� The display device is usually a video screen
� Name derived from Console OUTput and
pronounced “see out”
� Data is passed to cout by the insertion
symbol
cout << "Hello, World!" ;
2 consecutive characters "<"
![Page 36: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/36.jpg)
36
Trivial C++ Program
#include<iostream>using namespace std;int main( ){cout << "Hello World!\n" ;return 0;}
main is the
program entry
function
#include gives info on
standard IO library etc
C++ program is case sensitive Code saved as
file hello.cpp
White spaces are delimiters; line break is just a white
space
Each function is defined by a code block specified by a pair of { }
This is how things are sent
to the standard
output (screen here)
Literal strings are quoted
Statement must be ended with “; ”
![Page 37: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/37.jpg)
37
More Explanations
#include<iostream>using namespace std;int main( ) {cout << "Hello World!\n" ;return 0;}
int is key
word for integer, type for returned value
#include is a
complier directive
Header file containing info on the use of cout
cout is an
built-in object for output Value 0 here actually
treated as the program exit error level
“\n” presents
the newlinecharacter
Program edited by a text editor, not a word processor!
![Page 38: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/38.jpg)
38
Newline Escape Sequence
� Instructs the display device to move to a new line� A newline caused when the characters backslash \ and n are used together
� Backslash provides an “escape” from the normal interpretation of the character that follows
� Newline escape sequences can be placed anywhere within a message to cout
![Page 39: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/39.jpg)
39
Preprocessor Command
� Performs an action before the compiler translates source code to machine code
� e.g. #include <iostream>
� causes the iostream file to be inserted wherever the #includecommand appears
� iostream is part of the C++ standard library
![Page 40: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/40.jpg)
40
Namespaces
� Files accessed by compiler when looking for prewritten classes or functions
� Sample namespace statement:
� using namespace std;
� iostream contained in a namespace called std
� Compiler uses iostream’s cout object from std whenever cout is referenced
![Page 41: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/41.jpg)
41
DEV-C++ IDE
Free Compilers Downloadable at vUWS
TextPad Dev-C++
![Page 42: 300580 Programming Fundamentals - SCEM Staff Linux …staff.scem.uws.edu.au/~zhuhan/pfcpp/lectures/lect1/cpp1intro.pdf · 1 300580 Programming Fundamentals With C++ 1 Intro to Programming](https://reader031.fdocuments.in/reader031/viewer/2022020113/5a84589a7f8b9a9f1b8babb3/html5/thumbnails/42.jpg)
42
Reading and Actions
� Get SCEM username and password before the start of the next week!
� Visit the unit website via vUWS, and read the unit outline and lecture schedule there
� Check out your tutorial/practical time and venue
� First practical starts in the second week
� Read Bronson’s Chapter 1