Chapter 1 Introduction to Computers, the Internet and the Web.

Slides:



Advertisements
Similar presentations
EC-111 Algorithms & Computing Lecture #1 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.
Advertisements

Senem Kumova Metin Introduction to Programming CS 115 Introduction to Computing PART I : Computer Basics PART II: Introduction to Computing/Programming.
1 Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
Three types of computer languages
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Computing Components 01/26/11. Announcements & Reminders Programs 1 due Friday, 9/2/11 What is my late policy? Proxy Codes for Labs  You should be able.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition by Tony Gaddis, Judy Walters,
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
Using C Programming Language.  The programs that run on a computer are referred to as software.  You’ll learn key programming methodology that are enhancing.
Using C Programming Language.  The programs that run on a computer are referred to as software.  You’ll learn key programming methodology that are enhancing.
CS102 Introduction to Computer Programming
Introduction to Computers and Python. What is a Computer? Computer- a device capable of performing computations and making logical decisions at speeds.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
Chapter Introduction to Computers and Programming 1.
Introduction to Programming Dr Masitah Ghazali Programming Techniques I SCJ1013.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
“C” Programming Language What is language ? Language is medium of communication. If two persons want to communicate with each other, they have to use.
Topics Introduction Hardware and Software How Computers Store Data
Spring 2005, Gülcihan Özdemir Dağ BIL104E: Introduction to Scientific and Engineering Computing, Spring Outline 1.1Introduction 1.2What Is a Computer?
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
CISC105 General Computer Science Class 1 – 6/5/2006.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
An Introduction to Computers August 12, 2008 Mrs. C. Furman.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 1 Introduction to Computers and Programming.
1 Introduction to Computers Lect 1 Won’t tell you much you don’t know. (Misleading– the course gets more conceptual as we create webpages.) Will go into.
Introduction to the Computer System. What is a computer ? A computer is an electronic device that can accept data and instruction, process them or store.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Introduction Lecture 01.
Introduction to Computer Systems and the Java Programming Language.
 2006 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 1 February 8, 2005.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
Intro to Computers Computer Applications. What is a Computer? Initially the term computer referred to an individual whose job it was to perform mathematical.
Module 2 : Part 1 INTRODUCTION TO HARDWARE & SOFTWARE INTRODUCTION TO HARDWARE & SOFTWARE.
Computer Organization & Assembly Language © by DR. M. Amer.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
A.Abhari CPS1251 Topic 1: Introduction to Computers Computer Hardware Computer components Connecting Computers Computer Software Operating System (OS)
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
An overview of C Language. Overview of C C language is a general purpose and structured programming language developed by 'Dennis Ritchie' at AT &T's.
COMPUTER SYSTEM A computer system is define as combination of components designed to process data and store files. A computer system consists of four.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.
Chapter 1: Introduction to Computers and Programming
Java Programming: From the Ground Up
BASIC PROGRAMMING C SCP1103 (02)
Computer Science II Chapter 1.
Chapter 1: An Overview of Computers and Programming Languages
Engineering Problem Solving With C An Object Based Approach
Chapter 1: Introduction to computers and C++ Programming
CSC201: Computer Programming
Topics Introduction Hardware and Software How Computers Store Data
Chapter 1: An Overview of Computers and Programming Languages
BASIC PROGRAMMING C SCP1103 (02)
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
Chapter 1: Introduction to Computers and Programming
Topics Introduction Hardware and Software How Computers Store Data
Introduction to Computer Programming
Computer Programming-1 CSC 111
Computer components is a programmable machine that receives input, stores and manipulates data, and provides output in a useful format. Computer The computer.
Introduction to C Programming
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

Chapter 1 Introduction to Computers, the Internet and the Web

Computer Basics A computer consists of hardware and software Computer Hardware Physical components of a computer Processing unit, keyboard, monitor/screen, mouse, hard disk, memory, DVD drive, etc. Computer Software The instructions you write to command computers to perform actions and make decisions 2

Computer Organization Computer hardware can be divided into various logical units or sections Input Unit Output Unit Central Processing Unit (CPU) Arithmetic logic unit (ALU) Memory Unit Secondary Storage Unit 3

Computer Organization Input Unit Obtains information from the outside world through input devices Places that information at the disposal of the other units for processing. Examples of input devices Keyboard, touch screen, mouse/touch pad, joystick Microphones, scanners, cameras, bar code reader GPS device, accelerometer 4

Computer Organization Output unit Takes information the computer has processed and places it on various output devices to make it available for use outside the computer Examples of output devices Printer, plotter, screen, speaker, projector Robot, “intelligent” appliance 5

Computer Organization Central processing unit (CPU) The brain of the computer Coordinates and supervises the operation of the other sections Consists of Arithmetic logic unit (ALU) Registers (memory) Control unit (CU) Many of todays computers have multi-core processors Multiple CPUs on a single integrated-circuit chip 6

Computer Organization Arithmetic logic unit (ALU) Performs math operations (addition, subtraction, multiplication, division, etc.) and logic operations (AND, OR, NOT, etc.) Registers Used for fast access of data by other CPU components Control unit (CU) Controls the other parts of the CPU in order to execute instructions Fetches instructions and data from main memory Uses the ALU and registers to execute the instructions Called a fetch-execute cycle 7

Computer Organization Memory unit (also called main or primary memory) Rapid-access, relatively low-capacity “warehouse” section that is used to store computer instructions and computer information or data Each location in memory has an address, so data in a particular location can be accessed Data in memory is volatile RAM (Random access memory) 8

Computer Organization Secondary Storage Unit Long-term, high-capacity “warehousing” section Examples of secondary storage devices Hard drive, DVD drive, USB flash drive Storage capacity usually expressed in terms of GB or TB Data on secondary storage devices is persistent Cheaper, but takes much longer for the computer to access than main memory Input/output and secondary storage devices are also called peripherals 9

Computer Software The programs that allow the computer hardware to operate Computer program: A set of instructions for the computer to perform Two types of software System software Operating systems, utilities, language translators (assembler, compiler, interpreter) Application software Word processors, database management systems (DBMSs), graphics programs, games, payroll systems, etc. 10

Bits and Bytes Data and instructions – everything on a computer – is stored in memory in bits, or binary digits Bit – the smallest data item in a computer Can be in one of two states (1 or 0) 8 bits is called a byte 4 bits is called a nibble (or nybble) Bytes can be combined to form words The length of a word is system dependent 11

Bits and Bytes Letters, characters, numbers, instructions, etc., can all be represented by a combination of 0s and 1s. For example, the letter F can be represented by , which is the number 70 in decimal (base 10) This representation is based on ASCII (American Standard Code for Information Interchange) format Each letter, number, or character is represented using 1 byte See Appendix B for the ASCII character set 12

Bits and Bytes Unicode is another character coding system Universal Character Encoding Assigns a unique number to every character of every written language Length depends on the specific encoding used UTF-8 uses one byte for any ASCII character (same values) and up to 4 bytes for other characters 13

C Programming Language Developed by Dennis Ritchie at Bell Laboratories Originally implemented in 1972 Evolved from B B was developed and used by Ken Thompson to create early versions of the UNIX operation system Many of today’s leading operating systems are written in C and/or C++ C is mostly hardware independent With careful design, it’s possible to write C programs that are portable to most computers 14

C Programming Language C was built for systems that demand performance Operating systems, embedded systems, real-time systems, and communication systems C remains the most widely used embedded programming language C is a high-level language The 3 language types are machine, assembly, and high- level C is a compiled language A compiler converts the source code into machine language 15

C Development Process Phases of development: Edit: Programmer writes source code in an editor (.c) Preprocess: Preprocessor processes the source code Compile: Compiler translates the pre-processed source code into object code (.obj) – machine language Link: Linker links the object code with libraries and creates an executable file (.exe) Phases of execution: Load: The loader moves the executable program from secondary storage into memory Execute: The CPU takes each instruction and executes it 16

C Programming Language “Writing in C or C++ is like running a chain saw with all the safety guards removed.” (Bob Gray) 17

Chapter 2 Introduction to C Programming

A Simple C Program #include int main( void ) { printf(“Hello, world!”); return 0; } 19

#include int main( void ) { printf(“Hello, world!”); return 0; } Preprocessor directive Tells the compiler your program uses a function defined in the header file stdio.h The preprocessor takes the appropriate code from stdio.h and combines it with your program, which is sent to the compiler Preprocessor directives always start with # 20

#include int main( void ) { printf(“Hello, world!”); return 0; } Preprocessor directive stdio.h is a built-in header file, which provides standard input/output functions For built-in C header files, use around the name of the file If you try to use printf in a program without the #include statement, you will get a compiler error 21

#include int main( void ) { printf(“Hello, world!”); return 0; } Function declaration Every C program must have a main function Note: C is case sensitive int Main( void ) will not work! 22

#include int main( void ) { printf(“Hello, world!”); return 0; } Pairs of opening and closing braces are used to signal where a block of code (such as a function) begins and ends Every opening brace { must have a corresponding closing brace } or you will get a compiler error 23

#include int main( void ) { printf(“Hello, world!”); return 0; } This is a C statement A C program is a series of C statements Every C statement ends in a semi-colon ; The printf(“Hello, world!”); statement is a function call printf is used to print information to the screen 24

#include int main( void ) { printf(“Hello, world!”); return 0; } return 0; is a C statement Used to indicate our main function completed execution with no problem What is the output of the program? 25

Printing to the screen The printf function is used in C to print text to the screen Simplest form of printf printf( string ); string is any text you would like to print Text must be in double quotes Example printf(“C programming is fun!”); 26

Printing to the screen Each printf statement does not automatically advance to a new line You must explicitly tell the program when you want to move to a new line in the output For example, what is the output of the following program? #include int main( void ) { printf(“Hello!”); printf(“Goodbye!”); return 0; } 27

Printing to the screen To move to a new line when printing: Use the escape sequence \n inside the double quotes Modify program to print a new line between Hello! and Goodbye! #include int main( void ) { printf(“Hello!\n”); printf(“Goodbye!”); return 0; } 28

Escape Sequences Whenever a backslash ( \ ) is encountered in a printf statement, it indicates the character following the \ has a special meaning. Commonly used escape sequences 29 Escape SequenceMeaning \n Advance to a new line \a Beep \t Print a tab \\ Print a single backslash % Print a percent sign

Escape Sequences So, what if you want to print a \? If you want to print a \, you must use the escape sequence \\ What is the output of the following program? #include int main( void ) { printf(“\\\\\\”); return 0; } 30

In-Class Assignment #1