Fundamental Programming

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

C++ Basics March 10th. A C++ program //if necessary include headers //#include void main() { //variable declaration //read values input from user //computation.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 6 Functions.
1 11/05/07CS150 Introduction to Computer Science 1 Functions Chapter 6, page 303.
1 10/20/08CS150 Introduction to Computer Science 1 do/while and Nested Loops Section 5.5 & 5.11.
1 10/11/06CS150 Introduction to Computer Science 1 do/while and Nested Loops.
Switch structure Switch structure selects one from several alternatives depending on the value of the controlling expression. The controlling expression.
VARIABLES, TYPES, INPUT/OUTPUT, ASSIGNMENT OPERATION Shieu-Hong Lin MATH/CS Department Chapel.
Selection Statements in C++ If Statement in C++ Semantics: These statements have the same meaning as in the algorithmic language. 2- Two way selection:
1 Chapter 9 Additional Control Structures Dale/Weems/Headington.
COIT29222 Structured Programming Slide 1 COIT29222-Structured Programming Lecture Week 06  Reading: Study Guide Book 2, Modules 9 & 10 Textbook (4 th.
More on Input Output Input Stream : A sequence of characters from an input device (like the keyboard) to the computer (the program running). Output Stream.
M. Taimoor Khan #include void main() { //This is my first C++ Program /* This program will display a string message on.
Chapter 6: Functions Starting Out with C++ Early Objects
Semester Review. As we have discussed, Friday we will have in class time for you to work on a program, this program will come with instructions and you.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6: Functions Starting Out with C++ Early Objects Seventh Edition.
Copyright © Nancy Acemian 2004 For Loops-Break-Continue COMP For loop is a counter controlled loop. For loop is a pretest loop. Used when number.
Additional Control Structures. Chapter 9 Topics Switch Statement for Multi-way Branching Do-While Statement for Looping For Statement for Looping Using.
CPS120: Introduction to Computer Science Decision Making in Programs.
CSE 332: C++ execution control statements Overview of C++ Execution Control Expressions vs. statements Arithmetic operators and expressions * / % + - Relational.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 7 Clicker Questions September 22, 2009.
1 Lecture 04 Structural Programming in C++ You will learn: i) Operators: relational and logical ii) Conditional statements iii) Repetitive statements.
Chapters 1-5 Review C++ Class. Chapter 1 – the big picture Objects Class Inheritance Reusability Polymorphism and Overloading.
111/15/2015CS150 Introduction to Computer Science 1 Summary  Exam: Friday, October 17,  Assignment: Wednesday, October 15, 2003  We have completed.
Review the following : Flowcharting Variable declarations Output Input Arithmetic Calculations Conditional Statements Loops.
CSC1201: Programming Language 2 Lecture 1 Level 2 Course Nouf Aljaffan (C) CSC 1201 Course at KSU1.
1 10/18/04CS150 Introduction to Computer Science 1 Functions Divide and Conquer.
C++ Basics. Compilation What does compilation do? g++ hello.cpp g++ -o hello.cpp hello.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 6 Functions.
Starting Out with C++ Early Objects ~~ 7 th Edition by Tony Gaddis, Judy Walters, Godfrey Muganda Modified for CMPS 1044 Midwestern State University 6-1.
CHAPTER 10 ARRAYS AND FUNCTIONS Prepared by: Lec. Ghader Kurdi.
GE 211 Dr. Ahmed Telba. // compound assignment operators #include using namespace std; int main () { a =5 int a, b=3; a = b; a+=2; // equivalent to a=a+2.
Instructor - C. BoyleFall Semester
Review for Final Exam. Contents 5 questions (20 points each) + 1 bonus question (20 points) – Basic concepts in Chapters 1-4 – Chapters 5-9 – Bonus: Chapter.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
1 For Loops l From Chapter 9 l A shorthand way of coding count loops.
Fundamental Programming Fundamental Programming More on Repetition.
April 11, 2005 More about Functions. 1.Is the following a function call or a function header? calcTotal(); 2.Is the following a function call or a function.
1 Programming in C++ Dale/Weems/Headington Chapter 9 Additional Control Structures (Switch, Do..While, For statements)
Fundamental Programming Fundamental Programming More Expressions and Data Types.
Variables  A piece of memory set aside to store data  When declared, the memory is given a name  by using the name, we can access the data that sits.
Lecturer: Nguyen Thi Hien Software Engineering Department Home page: hienngong.wordpress.com Chapter 2: Language C++
 2003 Prentice Hall, Inc. All rights reserved. 1 Basic C++ Programming.
Chapter 6 Functions. 6-2 Topics 6.1 Modular Programming 6.2 Defining and Calling Functions 6.3 Function Prototypes 6.4 Sending Data into a Function 6.5.
Lesson xx Why use functions Program that needs a function Function header Function body Program rewritten using a function.
C syntax (simplified) BNF. Program ::= [ ] Directives ::= [ ] ::= | |… ::=#include > ::=#define.
CS Computer Science IA: Procedural Programming
C++, OBJECT ORIENTED PROGRAMMING
Variables A piece of memory set aside to store data
CMPT 201 Functions.
Introduction to C++ October 2, 2017.
New Structure Recall “average.cpp” program
CS 2308 Exam I Review.
Chapter 5 Function Basics
Chapter 6: Functions Starting Out with C++ Early Objects Ninth Edition
Functions A function is a “pre-packaged” block of code written to perform a well-defined task Why? Code sharing and reusability Reduces errors Write and.
Review for Final Exam.
CS150 Introduction to Computer Science 1
Summary Two basic concepts: variables and assignments Basic types:
CPS120: Introduction to Computer Science
CS 1428 Final Exam Review.
Review for Final Exam.
CS150 Introduction to Computer Science 1
CS150 Introduction to Computer Science 1
do/while Selection Structure
CS150 Introduction to Computer Science 1
CS150 Introduction to Computer Science 1
Welcome back to Software Development!
CS150 Introduction to Computer Science 1
Presentation transcript:

310201 Fundamental Programming Final Review

The place of programming The software development life cycle Analysis of problem Specification Design of algorithm Coding of program Testing and Debugging Documentation Maintenance

The five types of statement Input Output Assignment Selection Repetition

Selection If … Else … Switch

if-else statement if ((Age < 18) && (Sex=‘M’)) { cout << “A male child“ << endl; } else cout << “A male adult“ << endl;

Switch statement switch ( CharMenuSelection ) { case 'a': case 'A': ProcessSelectionA; break; case 'b': case 'B': ProcessSelectionB; default: ProcessOther; }

Repetition While loops Do … While loops For loops

While loop Sum = 0 ; Number = 5; while (Number > 0) { } cout << “The sum is “ << Sum << endl;

do-while loops if a task must be performed at least once, we can perform the test at the end of the loop using do-while do { cout << “Select a number between 1 and 5“; cin >> Num; } while ((Num<1) || (Num>5));

For loops for ( int Counter = 0; Counter < 5; Counter++ ) { cout << “Counter = “ << Counter << endl; }

Operators Arithmetic +, -, *, /, % Relational ==, !=, >, >=, <, <= Logical &&, ||, !

Variable Types Integer – int, long Floating point – float, double Character – char Boolean - bool

Modularization (1) Functions Library functions Function headers Prototypes Calling functions

Modularization (2) Global Variables Local Variables Parameters and Arguments Passing by Reference Passing by Value Return Values

Arrays Declaring Arrays Using Arrays Passing Arrays to Functions Strings Multidimensional Arrays

Summary We’ve finished!