Chad’s C++ Tutorial Demo Outline. 1. What is C++? C++ is an object-oriented programming (OOP) language that is viewed by many as the best language for.

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

Chapter 41 Variables and JSP Control Structures JavaServer Pages By Xue Bai.
10-Jun-15 Just Enough Java. Variables A variable is a “box” that holds data Every variable has a name Examples: name, age, address, isMarried Variables.
Additional control structures. The if-else statement The if-else statement chooses which of two statements to execute The if-else statement has the form:
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Loops Repetition Statements. Repetition statements allow us to execute a statement multiple times Often they are referred to as loops Like conditional.
UNIT II Decision Making And Branching Decision Making And Looping
C++ Programming Language Day 1. What this course covers Day 1 – Structure of C++ program – Basic data types – Standard input, output streams – Selection.
Day 4 Objectives Constructors Wrapper Classes Operators Java Control Statements Practice the language.
What is RobotC?!?! Team 2425 Hydra. Overview What is RobotC What is RobotC used for What you need to program a robot How a robot program works Framework.
EGR 2261 Unit 4 Control Structures I: Selection  Read Malik, Chapter 4.  Homework #4 and Lab #4 due next week.  Quiz next week.
Outlines Chapter 3 –Chapter 3 – Loops & Revision –Loops while do … while – revision 1.
Variable Declaration  It is possible to declare multiple variables of the same data type on the same line.  Ex. double hours, rate, total;  Variables.
© The McGraw-Hill Companies, 2006 Chapter 4 Implementing methods.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
Chapter 4: Control Structures I (Selection). Objectives In this chapter, you will: – Learn about control structures – Examine relational operators – Discover.
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.
Chapter 4: Control Structures I (Selection). Objectives In this chapter, you will: – Learn about control structures – Examine relational and logical operators.
CPS120: Introduction to Computer Science Decision Making in Programs.
CSC 107 – Programming For Science. Announcements  Memorization is not important, but…  … you will all still be responsible for information  Instead.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 2: Variables & Data Types.
ㅎㅎ logical operator if if else switch while do while for Third step for Learning C++ Programming Repetition Control Structures.
Chapter 3. Outline Relational Operators Loops Decisions Logical Operators Precedence Summary.
CSC 107 – Programming For Science. The Week’s Goal.
CMP-MX21: Lecture 4 Selections Steve Hordley. Overview 1. The if-else selection in JAVA 2. More useful JAVA operators 4. Other selection constructs in.
Week 3 - Wednesday.  What did we talk about last time?  Other C features  sizeof, const  ASCII table  printf() format strings  Bitwise operations.
Chapter 7 Selection Dept of Computer Engineering Khon Kaen University.
C++ Lecture 1 Friday, 4 July History of C++ l Built on top of C l C was developed in early 70s from B and BCPL l Object oriented programming paradigm.
VARIABLES, CONSTANTS, OPERATORS ANS EXPRESSION
1-Dec-15 Additional control structures. 2 The if-else statement The if-else statement chooses which of two statements to execute The if-else statement.
Operators in JAVA. Operator An operator is a symbol that operates on one or more arguments to produce a result. Java provides a rich set of operators.
C++ / G4MICE Course Session 1 - Introduction Edit text files in a UNIX environment. Use the g++ compiler to compile a single C++ file. Understand the C++
Chapter 4: Control Structures I (Selection). Objectives In this chapter, you will: – Learn about control structures – Examine relational and logical operators.
Programming Fundamentals. The setw Manipulator setw changes the field width of output. The setw manipulator causes the number (or string) that follows.
Chapter 4 October 22, The If Statement Programs make decisions If(condition){ Statement(s); } Condition  boolean expression Evaluates to either.
Iteration & Loop Statements 1 Iteration or Loop Statements Dept. of Computer Engineering Faculty of Engineering, Kasetsart University Bangkok, Thailand.
Chapter 2: Fundamental Programming Structures in Java Adapted from MIT AITI Slides Control Structures.
C Language 1 Program Looping. C Language2 Topics Program looping Program looping Relational operators / expressions Relational operators / expressions.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
1 Flow of Control Chapter 5. 2 Objectives You will be able to: Use the Java "if" statement to control flow of control within your program.  Use the Java.
Week 3 - Friday.  What did we talk about last time?  Preprocessor directives  Other C features  sizeof, const  ASCII table  printf() format strings.
Learning Javascript From Mr Saem
Introduction to Programming G50PRO University of Nottingham Unit 6 : Control Flow Statements 2 Paul Tennent
Windows Programming Lecture 06. Data Types Classification Data types are classified in two categories that is, – those data types which stores decimal.
Chapter 4: Control Structures I (Selection). Objectives In this chapter, you will: – Learn about control structures – Examine relational operators – Discover.
Copyright © 2014 Pearson Addison-Wesley. All rights reserved. 4 Simple Flow of Control.
1 Chapter 4 - Control Statements: Part 1 Outline 4.1 Introduction 4.4 Control Structures 4.5 if Selection Structure 4.6 if/else Selection Structure 4.7.
Bill Tucker Austin Community College COSC 1315
Discussion 4 eecs 183 Hannah Westra.
Chapter 4 – C Program Control
Java Language Basics.
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
Data Types and Expressions
BASIC ELEMENTS OF A COMPUTER PROGRAM
EGR 2261 Unit 4 Control Structures I: Selection
Test Review Computer Science History
Arrays, For loop While loop Do while loop
Starting JavaProgramming
Outline Altering flow of control Boolean expressions
Module 2: Understanding C# Language Fundamentals
3 Control Statements:.
C Programming Getting started Variables Basic C operators Conditionals
SELECTIONS STATEMENTS
Chapter 3: Selection Structures: Making Decisions
2. Second Step for Learning C++ Programming • Data Type • Char • Float
CHAPTER 21 LOOPS 1.
Chapter 3: Selection Structures: Making Decisions
Chap 7. Advanced Control Statements in Java
OPERATORS in C Programming
OPERATORS in C Programming
Presentation transcript:

Chad’s C++ Tutorial Demo Outline

1. What is C++? C++ is an object-oriented programming (OOP) language that is viewed by many as the best language for creating large-scale applications. C++ is a superset of the C language. (Thanks Google) We use programing languages such as C++ because a computer can only understand machine, code consisting of ones and zeros. Programming in ones and zeros would be far too tedious. This is where the compiler comes in, it translates C++ into machine. It is also important to know that the compiler starts compiling a main.cpp file(This doesn’t mean it will always be called “main”) first, and code is always executed from top to bottom.

2. Console Out Syntax: std::cout

3. Data Types int = Whole Numbers float = Decimal Numbers double = More decimal places than a float bool = true or false/1 or 0 char = A character, use ‘ not “(Ex: ‘c’) string = “A set of characters”

4. Variables Variables provide us with a named storage for all data types. Our programs will be able to manipulate these variables at any time(Unless they are constant).

5. Console In Syntax: std::cin

6. Strings A string is a data type containing a series of characters. Must #include Show.length() function.

7. Constants Adding the “const” operator before a Data Type or class(when creating an Object) will create a constant Variable or Object. This means the program will no longer be able to change the value of the Variable once it's been declared, doing so will result in an error when compiling.

8. Arithmetic Operators = Assignment Operator + Addition Operator - Subtraction Operator * Multiplication Operator / Division Operator % Modulo Operator

9. Compound Assignment Operator Adding an = after an Arithmetic Operator will add/subtract/divide/multiply the defined value by itself. Syntax: int a = 5; a += 10; Output: A would be equal to 15.

10. Increment and Decrement Operators ++ Adds 1 to a variable -- Subtracts 1 from a variable These can be placed before or after a variable’s name, though after is most common. You Should be able to complete Chapter 1-1 now.

11. Relation Operators == Is equal to != Is not equal to < Less than > Greater than <= Less than or equal to >= Greater than or equal to

12. Logical Operators ! Not operator(Goes before variable name) && And operator || Or operator

13. Comma Operator The Comma Operator can be use to separate two or more expressions.

14. sizeof Operator Calling the “sizeof()” function will determine the size of a variable.

15. Conditional Statements You can use conditional statements to test certain conditions using the Relation Operators we learned about earlier. “If” statements are used to execute code if the condition(s) is/are true. “else” statements are used after an “if” statement to execute code if the condition is false. Alternatively if you wanted to test another condition you could use a “else if” statement. You Should be able to complete Chapter 1-2 now.

16. For Loop For Loops are most commonly used for executing the same code a specific number of times. A for loop’s parameters are divided into three parts. The first part which allows you to create a starting variable. The second part after the first “;” is where a condition, based off your starting variable is placed. The third part after the second “;” is where an increment statement is placed. You could do something simple like “x++” if you only wanted to execute the loop 9 times, or “x = x + 3” if you only wanted to execute the loop twice. This works because the condition is checked every time the loop is executed. When the condition is false, the code will be ignored by the compiler. Syntax: for(int x = 1; x<10; x++){ }

17. While Loop A while loop can be used like an if statement. If the condition is true the code in the loop will execute until the condition becomes false. In most if not all cases, you’ll want to include some kind of increment statement in your while loop that will eventually make your condition false. This is important because If you make an infinite loop your program will end up crashing.

18. Do While Loop Unlike “for” and “while” loops, a Do While Loop will execute its code one then check the condition to decide whether or not it will execute again. These are useful because they are guaranteed to execute at least once. You Should be able to complete Chapter 1-3 now.

19. Switch/Case Statements A switch statement allows you to test a list of values for one constant such as an integer. The variable being tested is called the Switch, and the possible values being tested is called a Case. After a case is executed you’ll want to Break, telling your program to stop testing other values. You can also include the optional Default case which acts like an “else” statement and executes itself if all cases are false. Keep in mind that the default case should(But doesn’t have to) appear at the end of a Switch statement and no “break” is needed. You Should be able to complete Chapter 1-4 now.