INTRODUCTION T.Najah Al_Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System CS240.

Slides:



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

 C++ programming facilitates a disciplined approach to program design. ◦ If you learn the correct way, you will be spared a lot of work and frustration.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 1 – Introduction to Computers and C++ Programming Outline 1.6 Machine Languages, Assembly Languages,
Introduction Kingdom of Saudi Arabia Shaqra University
COSC 120 Computer Programming
Your First C++ Program Aug 27, /27/08 CS 150 Introduction to Computer Science I C++  Based on the C programming language  One of today’s most.
Wednesday, 9/4/02, Slide #1 1 CS 106 Intro to CS 1 Wednesday, 9/4/02  Today: Introduction, course information, and basic ideas of computers and programming.
Three types of computer languages
If You Missed Last Week Go to Click on Syllabus, review lecture 01 notes, course schedule Contact your TA ( on website) Schedule.
Chapter 8: Introduction to High-level Language Programming Invitation to Computer Science, C++ Version, Third Edition.
 2003 Prentice Hall, Inc. All rights reserved. 1 Machine Languages, Assembly Languages, and High-level Languages Three types of computer languages 1.Machine.
Guide To UNIX Using Linux Third Edition
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Chapter 8: Introduction to High-level Language Programming Invitation to Computer Science, C++ Version, Third Edition.
CHAPTER 1: INTORDUCTION TO C LANGUAGE
Chapter 01: Introduction to Computer Programming
COMPUTER SCIENCE I C++ INTRODUCTION
 2008 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
Elements of a C++ program 1. Review Algorithms describe how to solve a problem Structured English (pseudo-code) Programs form that can be translated into.
Hello World 2 What does all that mean?.
Goals of Course Introduction to the programming language C Learn how to program Learn ‘good’ programming practices.
History of C and C++ C++ evolved from C ANSI C C++ “spruces up” C
C++ Basics Structure of a Program. C++ Source Code Plain text file Typical file extension .CPP Must compile the C++ source code without errors before.
Programming With C.
/* Documentations */ Pre process / Linking statements Global declarations; main( ) { Local Declarations; Program statements / Executable statements; }
 2008 Pearson Education, Inc. All rights reserved. 1 CISC 1600 – Computer Science I Fall 2010 Introduction to C++ Programming Chapters 1 and 2 (Deitel.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 1 February 8, 2005.
Week 1 Algorithmization and Programming Languages.
Programming Fundamentals. Today’s Lecture Why do we need Object Oriented Language C++ and C Basics of a typical C++ Environment Basic Program Construction.
COMPUTER PROGRAMMING. A Typical C++ Environment Phases of C++ Programs: 1- Edit 2- Preprocess 3- Compile 4- Link 5- Load 6- Execute Loader Primary Memory.
CHAPTER 2 PART #1 C++ PROGRAM STRUCTURE 1 st semester H 1 King Saud University College of Applied studies and Community Service Csc 1101 By:
INTRODUCTION Kingdom of Saudi Arabia Princess Nora bint Abdul Rahman University College of Computer Since and Information System CS240.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
COMPUTER PROGRAMMING. Computer programming the objective of the module to gain the necessary skills to develop a computer program using one of the high.
1 C++ Programming Basics Chapter 1 Lecture CSIS 10A.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Basic Program Construction
Chapter 2 part #1 C++ Program Structure
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
CHAPTER 1: INTRODUCTION C++ Programming. CS 241 Course URL: Text Book: C++ How to Program, DETITEL & DEITEL, eighth Edition.
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.
Objective Write simple computer program in C++ Use simple Output statements Become familiar with fundamental data types.
 2003 Prentice Hall, Inc. All rights reserved Basics of a Typical C++ Environment C++ systems –Program-development environment –Language –C++
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
1 8/30/06CS150 Introduction to Computer Science 1 Your First C++ Program.
Introduction to Programming By: Prof. Muhammad Abu Baker Siddique 2 nd Lecture 1.
Chapter 1 Introduction 2nd Semester H
C++ Lesson 1.
Programming what is C++
CHAPTER 2 PART #1 C++ PROGRAM STRUCTURE
Chapter 1: Introduction to computers and C++ Programming
CSC201: Computer Programming
1.2 What is a Computer? Computer Computer programs Hardware Software
Completing the Problem-Solving Process
CS-103 COMPUTER PROGRAMMING
Chapter 2 part #1 C++ Program Structure
Beginning C++ Programming
C++ Programming: From Problem Analysis to Program Design
Hello World 2 What does all that mean?.
Programming 1 (CS112) Dr. Mohamed Mostafa Zayed 1.
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Variables T.Najah Al_Subaie Kingdom of Saudi Arabia
Programming Fundamentals Lecture #3 Overview of Computer Programming
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Introduction to Computer Programming
Programs written in C and C++ can run on many different computers
Capitolo 1 – Introduction C++ Programming
Chapter 1 c++ structure C++ Input / Output
Chapter 2 part #1 C++ Program Structure
Presentation transcript:

INTRODUCTION T.Najah Al_Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System CS240

Instructor: Najah AL-Subaie Course URL: Text Book:  C++ How to Program, DETITEL & DEITEL, eighth Edition  C++ Without Fear A Biggener's Guide That Makes You Feel Smart, Brian Overland

Course Syllabus Topics Introduction Data types, variables, values, assignment Sequence, iteration, branching statements Functions Arrays Pointers and Strings Recursion

Course Objectives  Learn data types, control structures, functions, and arrays.  Learn algorithms and problem-solving.  Learn analysis of problems using structured programming.  Learn program correctness and verification.  Learn the mechanics of running, testing, and debugging

Grading  2 Midterms : 25%  Project: 5%  Lab work : 10%  Final exam: 40%  Final lab: 20%  Bonus: +5 Marks (Pop quizzes)

Our first Question !!  What are the differences between hardware and software?!!  Computer hardware is any physical device (e.g. the computer monitor), something that you are able to touch and software (e.g. Internet browser) is a collection of instructions and code installed into the computer and cannot be touched.  What is the relation between SW and HW??  Software (Instruction) controls hardware (computer).

Programming Languages  Machine Language  The only language computer directly understands  Generally consists of 0s and 1s:  It is difficult to understand by humans.  To calculate wages= rates * hours in machine language: // Load //Multiply //Store

Programming Languages  Assembly language  English-like abbreviations to represent computer operations.  Clearer to humans.  Incomprehensible to computers.  Assemblers : convert program to machine language. Machine LanguageAssembly Language LOAD STOR MULT ADD

Programming Languages  High-level language  Similar to everyday language.  Uses common mathematical notations.  Clearer to humans.  Incomprehensible to computers.  (compilers): convert program to machine language.  The equation: wages= rate * hours written in C++: Wages=rate * hours;

Basics of C++ Environment  C++ programs typically go through six phases to be executed.  Edit: Programmer types a C++ program.  Preprocess: e.g. include other text files to be compiled.  Compile: translate the C++ program into machine language code.  Link: links the code with the code for the missing functions.  Load: load the executable code on memory.  Execute: CPU executes the program one instruction at time.

Structure of a program Output

Structure of a Program Cont. // my first program in C++  This is a comment line.  All lines beginning with two slash signs (//) are considered comments and do not have any effect on the behavior of the program.  The programmer can use them to include short explanations or observations within the source code itself.  In this case, the line is a brief description of what our program is.

Structure of a Program Cont. #include  Lines beginning with a hash sign (#) are directives for the preprocessor.  The directive #include tells the preprocessor to include the iostream standard file.  This specific file (iostream) includes the declarations of the basic standard input-output library in C++,

Structure of a Program Cont. using namespace std;  All the elements of the standard C++ library are declared within what is called a namespace, the namespace with the name std.  So in order to access its functionality we declare with this expression that we will be using these entities. This line is very frequent in C++ programs that use the standard library.

Structure of a Program Cont. int main ()  This line corresponds to the beginning of the definition of the main function.  The main function is the point by where all C++ programs start their execution.  int in the left, indicates that main “return” an integer.  The word main is followed in the code by a pair of parentheses ().  Right after these parentheses we can find the body of the main function enclosed in braces {}. What is contained within these braces is what the function does when it is executed.

Structure of a Program Cont. cout << "Hello World!";  This line is a C++ statement.  A statement is a simple or compound expression.  cout is the name of the standard output stream in C++.  The meaning of this statement is to print “ Hello World!” on the screen.  The semicolon (;) is used to mark the end of the statement.  Semicolon must be included at the end of all expression statements in all C++.

Structure of a Program Cont. return 0;  The return statement causes the main function to finish.  It indicate that the program ended successfully.