- A computer is a device capable of performing computations and making logical decisions at speeds millions, and even billions, of times faster than human beings can.
- Computers process data under the control of computer programs.
- The various devices (such as the keyboard, screen, disk, memory, and processing units) that comprise a computer system are referred to as hardware.
- The computer programs that run on a computer are referred to as software.
- The input unit is the "receiving" section of the computer. Most information is entered into computers today through typewriter-like keyboards.
- The output unit is the "shipping' section of the computer. Most information is output from computers today by displaying it on screens or by printing it on paper.
- The memory unit is the "warehouse" section of the computer, and is often called either memory or primary memory.
- The arithmetic and logic unit (ALU) performs calculations and makes decisions.
- Program or data not actively being used by the other units are normally placed on secondary storage devices (such as disks) until they are again needed.
- In single-user batch processing, the computer runs a single program at a time while processing data in groups or batches.
- Operating systems are software systems that make it more convenient to use computers and to get the best performance from computers.
- Multiprogramming operating systems enable the "simultaneous" operation of many jobs on the computer--the computer shares its resources among the jobs.
- Timesharing is a special case of multiprogramming in which users access the computer through terminals. The users' programs appear to be running simultaneously.
- With distributed computing, an organization's computing is distributed via networking to the sites where the real work of the organization is performed.
- Servers store programs and data that may be shared by client computers distributed throughout a network, hence the term client/server computing.
- Any computer can directly understand only its own machine language.
- Machine languages generally consist of strings of numbers (ultimately reduced to 1 s and 0 s) that instruct computers to perform their most elementary operations one at a time. Machine languages are machine-dependent.
- English-like abbreviations form the basis of assembly languages. Assemblers translate assembly language programs into machine language.
- Compilers translate high-level language programs into machine language. High-level languages contain English words and conventional mathematical notations.
- Interpreter programs directly execute high-level language programs without the need for compiling those programs into machine language.
- Although compiled programs execute faster than interpreted programs, interpreters are popular in program development environments in which programs are recompiled frequently as are features are added and errors are corrected. Once a program is developed, a compiled version can then be produced to run more efficiently.
- It is possible to write programs in C and C++ that are portable to most computers.
- FORTRAN (FORmula TRANslator) is used for mathematical applications.
- COBOL (Common Business Oriented Language) is used primarily for commercial applications that require precise and efficient manipulation of large amount of data.
- Structured programming is a disciplined approach to writing programs that are clearer than unstructured programs, easier to test and debug, and easier to modify.
- Pascal was designed for teaching structured programming in academic environments.
- Ada was developed under the sponsorship of the United States Department of Defense (DOD) using Pascal as a base.
- Multitasking allows programmers to specify parallel activities.
- All C++ systems consists of three parts: the environment, the language, and the standard libraries. Library functions are not part of the C++ language itself; these functions perform operations such as popular mathematical calculations.
- C++ programs typically go through six phases to be executed; edit, preprocess, compile, link, load, and execute.
- The programmer types a program with an editor and makes corrections if necessary. C++ file names on a typical UNIX-based system end with the .C extension.
- A compiler translates a C++ program into machine language code (or object code).
- The preprocessor obeys preprocessor directives which typically indicate files to be included in the file being compiled, and special symbols to be replaced with program text.
- A linker links the object code with the code for missing functions to produce an executable image (with no missing pieces). On a typical UNIX-based system, the command to compile and link a C++ program is CC. If the program compiles and links correctly a file called a.out is produced. This is the executable image of the program.
- A loader takes an executable image from disk and transfers it to memory.
- A computer, under the control of its CPU, executes a program one instruction at a time.
- Errors like division-by-zero errors occur as a program runs, so these errors are called run-time errors or execution-time errors.
- Divide-by-zero is generally a fatal error, i.e., an error that causes the program to terminate immediately without having successfully performed its job. Non-fatal errors allow programs to run to completion, often producing incorrect results.
- Certain C++ functions take their input from cin (the standard input stream) which is normally the keyboard, but cin can be connected to another device. Data is output to cout (the standard output stream) which is normally the computer screen, but cout can be connected to another device.
- The standard error stream is referred to as cerr. The cerr stream (normally connected to the screen) is used for displaying error messages.
- There are many variations between different C++ implementations and different computers that make portability an elusive goal.
- C++ provides capabilities to do object-oriented programming.
- Objects are essentially reusable software components that model items in the real world. Objects are made from "blueprints" called classes.
- Single-line comments begins with //. Programmers insert comments to document programs and improve their readability. Comments do not cause the computer to perform any action when the program is run.
- The line #include<iostream.h> tells the C++ preprocessor to include the contents of the input/output stream header file in the program. This file contains information necessary to compile programs that use cin and cout and operators << and >>.
- C++ programs begin executing at the function main.
- The output stream object cout--normally connected to the screen--is used to output data. Multiple data items can be output by concatenating stream insertion (<<) operators.
- The input stream object cin--normally connected to the keyboard--is used to input data. Multiple data items can be input by concatenating stream extraction (>>) operators.
- All variables in a C++ program must be declared before they can be used.
- A variable name in C++ is any valid identifier. An identifier is a series of characters consisting of letters, digits, and underscores (_). Identifiers cannot start with a digit. C++ identifiers can be any length; however, some systems and/or C++ implementations may impose restrictions on the length of identifiers.
- C++ is case sensitive.
- Most calculations are preformed in assignment statements.
- Every variable stored in the computer's memory has a name, a value, a type and a size.
- Whenever a new value is placed in a memory location, it replaces the previous value in that location. The previous value is destroyed.
- When a value is read from memory, the process is nondestructive, i.e., a copy of the value is read leaving the original value undisturbed in the memory location.
- C++ evaluates arithmetic expressions in a precise sequence determined by the rules of operator precedence and associativity.
- The if statement allows a program to make a decision when a certain condition is met The format for an if statement is
if (condition)
statement;
- If the condition is true, the statement in the body of the if is executed. If the condition is not met, i.e., the condition is false, the body statement is skipped.
- Conditions in if statements are commonly formed by using equality operators and relational operators. The result of using these operators is always simply the observation of "true" or "false".
- Object-orientation is a natural way of thinking about the world and of writing computer programs.
- Objects have attributes (like, size, shape, color, weight, and the like) and they exhibit behaviors.
- Humans learn about objects by studying their attributes and observing their behaviors.
- Different objects can have many of the same attributes and exhibit similar behaviors.
- Object-oriented programming (OOP) models real-world objects with software counterparts. It takes advantage of class relationships where objects of a certain class have the same characteristics. It takes advantage of inheritance relationships, and even multiple inheritance relationships where newly created classes are derived by inheriting characteristics of existing classes, yet contain unique characteristics of their own.
- Object-oriented programming provides an intuitive way to view the programming process, namely be modeling real-world objects, their attributes, and their behaviors.
- OOP also models communication between objects via messages.
- OOP encapsulates data (attributes) and functions (behavior) into objects.
- Objects have the property of information hiding. Although objects may know how to communicate with one another across well defined interfaces, objects normally are not allowed to know implementation details of other objects.
- Information hiding is crucial to good software engineering.
- In C and other procedural programming languages, programming tends to be action-oriented. Data is certainly important in C, but the view is that data exists primarily in support of the actions that functions perform.
- C++ programmers concentrate on creating their own user-defined types called classes. Each class contains data as well as the set of functions that manipulate the data. The data components of a class are called data members. The function components of a class are called member functions or methods.