Introduction to Computer ScienceCSCI 1010 : Introduction to Computer ScienceCSCI 1010
Objectives : Objectives Understand the purpose of a computer from a computer scientist viewpoint
Understand the purpose of a programming language for the computer
Learn a programming language (we will learn C++)
Develop good programming techniques
Learn the meaning of top-down programming and object-oriented programming (OOP)
Become proficient in constructing, debugging, running, and testing C++ programs
The Computer : The Computer The Computer is not just about about
The cute animated paper clips
The graphical icons
The animated web pages
The Computer is about much, much more
The Computer is about : The Computer is about Solving problems
Collecting data
Massaging the data to produce useful information
Displaying the information in the most useful form
Using most efficient techniques in performing these task
The Computer is about : The Computer is about Bits and Bytes
As when the digital computer was first invented,
the computer only understands 0 and 1
called Binary number system
Turn the light on or turn the light off
Example of a typical machine-readable instruction0100 1010 0101 0011
Programming languages : Programming languages A programming language is a set of instructions, data, and rules that can be used to construct a machine-readable program.
In C++, the above may be C=A+B;
There are over 200 programming languages
Levels of Computer Languages : Levels of Computer Languages Low level
“Close” to the CPU
Easy for the computer to understand
Not portable
High level
Hides computer architecture details
Often uses natural language
Easy for humans
More portable
Example Low Level Computer Languages : Example Low Level Computer Languages Machine language
Assembly language
Example High Level Computer Languages : Example High Level Computer Languages COBOL
Pascal
Algol
FORTRAN
LISP
PL/I
RPG
Java
C and C++
Python
How C++ Evolved : How C++ Evolved BCPL
Designed in the 1960s by Martin Richards while at MIT
B
Developed by Ken Thompson as a systems programming language for the UNIX operating system (Bell Labs)
History of C++ Continued : History of C++ Continued C
Developed from 1969-1973 at Bell labs, at the same time the UNIX operating system was being developed there.
NB
In 1971 Dennis Ritchie at Bell Labs extended the B language (by adding types).
In 1983, with various versions of C floating around the computer world, American National Standards Institute (ANSI) established a committee that eventually published a standard for C in 1989.
History of C++ Continued : History of C++ Continued In 1983 Bjarne Stroustrup at Bell Labs created C++
He called it C with classes
C++
Designed for the UNIX system environment.
Represents an enhancement of the C programming language.
Enables programmers to improve the quality of code produced, thus making reusable code easier to write.
History of C++ Continued : History of C++ Continued For more information go to http://www2.research.att.com/~bs/homepage.html
How difficult is this course? : How difficult is this course? It depends on you.
If you want to succeed, you MUST
Learn some Linux commands and the vi editor on our server, cscilinux3.apsu.edu
Learn the syntax of C++, i.e., the proper way to write the language
Pay close attention to details of the syntax
For example, { and ( have special meaning
Learn good programming techniques
Learn to decompose a problem into the simplest possible steps
Seek help when you are having a problem
Be organized
Succeeding in this Course : Succeeding in this Course Do the above and this course will be easy, interesting, self-fulfilling, and highly beneficial to your future
Do not do the above and this course will be HARD
Compilation : Compilation Recall that a computer can only execute a machine readable instruction (a string of 0’s and 1’s)
For the C++ program, called source code, to run on a computer, the program must be convert to machine readable.
This is accomplished by another program called the C++ Compiler.
After the program is compiled, it must be sent to another program called the linker.
Sometimes your program may use other programs.
The linker will find the other programs and combine them with yours.
The linker also creates the final, executable program.
Each step may result in errors which must be corrected before continuing.
Intermediate Step in the Compiler : Intermediate Step in the Compiler There are many statements that are needed by most programs.
We could write these statements each time that we need them, but that is redundant and error prone
Instead, the statements are maintained in a “header” file (like a sub-program).
The compiler must find the header files and add them to your program before it can be compiled.
This step is called preprocessor.
The next two slides will illustrate this.
Source to Executable : Source to Executable source code
Linux Operating System and the GNU Compiler : Linux Operating System and the GNU Compiler We will be using the Linux Operating System on our Linux server
The GNU C++ compiler will be used
The output will of the compiler will be a file named a.out
a.out will be your executable program