120 likes | 249 Views
Overview of Computers and Programming Languages. What is a computer What is a programming language C++ Structured vs. object-oriented programming A simple program. What Is A Computer. A computer is a device capable of performing computations and making logical decisions at very high speed
E N D
Overview of Computers and Programming Languages • What is a computer • What is a programming language • C++ • Structured vs. object-oriented programming • A simple program Chapter 1 Overview of Computers and Programming Languages
What Is A Computer • A computer is a device capable of performing computations and making logical decisions at very high speed • A computer can do nothing without software. Chapter 1 Overview of Computers and Programming Languages
What Is A Computer • Input unit • Output unit • Memory Unit • Arithmetic logic unit (ALU) • Central processing unit (CPU) • Secondary storage unit Secondary Storage Unit Output Unit CPUALUMemory Unit Input Unit Chapter 1 Overview of Computers and Programming Languages
What Is A Programming Language • A vocabulary and set of grammatical rules for instructing a computer to perform specific tasks. • The term programming language usually refers to high-level languages, such as BASIC, C, C++, COBOL, FORTRAN, Java, and Pascal. From http://webopedia.internet.com/ Chapter 1 Overview of Computers and Programming Languages
Programming Language Hierarchy • Machine Language100100 010001100110 010010100010 010011 • Assembly LanguageLOAD rateMULT hoursSTOR wages • High-level Languagewages = rate * hours http://www.webopedia.com Chapter 1 Overview of Computers and Programming Languages
C++ Development Environment C++ Language C++ Standard Library C++ System Underlying Software VocabularyGrammatical Rules Precompiled Routine Program Chapter 1 Overview of Computers and Programming Languages
C++ Development Environment .cpp .obj .exe Chapter 1 Overview of Computers and Programming Languages
Structured Programming • AlgorithmA set of steps to solve a problem. • Structured design approach • Top-down design • Stepwise refinement • Modular programming Chapter 1 Overview of Computers and Programming Languages
Example of Algorithm • Find the perimeter and area of a rectangle • Get the length of the rectangle • Get the width of the rectangle • Find the perimeter using the followingperimeter = 2 * (length + width) • Find the area using the followingarea = length * width • Output the result Chapter 1 Overview of Computers and Programming Languages
Object-Oriented Programming • First step: identify components of the problem space ---- objectsrectangle • Second step: specify for objects their attributes (data) and possible operations (methods) to be performed on these attributes • OOP still needs structured programming techniques Chapter 1 Overview of Computers and Programming Languages
New project -> Visual C++ -> “Win32 Console Applications” • “Console application” + “Empty project” • Project -> Add new item ->Visual C++ -> Code -> C++ file (.cpp) Chapter 1 Overview of Computers and Programming Languages