CPS120: Introduction to Computer Science

Slides:



Advertisements
Similar presentations
Introducing JavaScript
Advertisements

IT151: Introduction to Programming
Dale Roberts Introduction to Java - First Program Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and.
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
Introduction to C++ Programming. A Simple Program: Print a Line of Text // My First C++ Program #include int main( ) { cout
Introduction to C++ September 12, Today’s Agenda Quick Review Check your programs from yesterday Another Simple Program: Adding Two Numbers Rules.
Introduction to C Programming
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 2: Your First Program.
1 8/30/06CS150 Introduction to Computer Science 1 Your First C++ Program.
Chapter 2: Introduction to C++.
Introduction to C Programming
1. 2 Chapter 1 Introduction to Computers, Programs, and Java.
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
By: Mr. Baha Hanene Chapter 3. Learning Outcomes We will cover the learning outcome 02 in this chapter i.e. Use basic data-types and input / output in.
Introduction to C++ - How C++ Evolved Most popular languages currently: COBOL, Fortran, C, C++, Java (script) C was developed in 1970s at AT&T (Richie)
CPS120: Introduction to Computer Science Lecture 8.
Chapter 3 Getting Started with C++
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.
Computer Programming TCP1224 Chapter 3 Completing the Problem-Solving Process and Getting Started with C++
Board Activity Find your seat on the seating chart Login – Remember your login is your first initial your last name and the last three numbers of your.
CPS120: Introduction to Computer Science
/* Documentations */ Pre process / Linking statements Global declarations; main( ) { Local Declarations; Program statements / Executable statements; }
Sharda University P. K. Mishra (Asst.Prof) Department of Computer Science & Technology Subject Name: Programming Using C Sub Code: CSE-106 Programming.
Copyright © 2012 Pearson Education, Inc. Chapter 2: Introduction to C++
Introduction to programming in the Java programming language.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 1 Simple Python Programs Using Print, Variables, Input.
Built-In and user-Defined functions Software Design Concepts Lecture IV Dr. Sothy Vignarajah.
Basic Program Construction
CC112 Structured Programming Lecture 2 1 Arab Academy for Science and Technology and Maritime Transport College of Engineering and Technology Computer.
A first program 1. #include 2. using namespace std; 3. int main() { 4. cout
CPS120: Introduction to Computer Science Introduction to C++
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 1 Introduction to Computers, Programs,
12/14/2016CS150 Introduction to Computer Science 1 Announcements  Website is up!   All lecture slides, assignments,
Introduction to Algorithmic Processes CMPSC 201C Fall 2000.
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
SUMMARY OF CHAPTER 2: JAVA FUNDAMENTS STARTING OUT WITH JAVA: OBJECTS Parts of a Java Program.
Programming Basics - RobotC Introduction to Robotics.
Intro. to Computer Programming Eng. Nehal A. Mohamed Spring Semester-2016.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
2.1 The Part of a C++ Program. The Parts of a C++ Program // sample C++ program #include using namespace std; int main() { cout
STRUCTURED PROGRAMMING Complete C++ Program. Content 2  Main Function  Preprocessor directives  User comments  Escape characters  cout statement.
Bill Tucker Austin Community College COSC 1315
Foundations of Computer Science C & C++ programming lecture 2
Chapter 1.2 Introduction to C++ Programming
Programming what is C++
Chapter Topics The Basics of a C++ Program Data Types
Chapter 1.2 Introduction to C++ Programming
Chapter 1.2 Introduction to C++ Programming
Topic Pre-processor cout To output a message.
Chapter 1.2 Introduction to C++ Programming
CSC201: Computer Programming
Chapter 2: Introduction to C++
Chapter 2, Part I Introduction to C Programming
Chapter 2 part #1 C++ Program Structure
Basic Elements of C++.
Introduction to C++ Introduced by Bjarne Stroustrup of AT&T’s Bell Laboratories in mid-1980’s Based on C C++ extended C to support object-oriented programming.
Intro to Java.
Introduction Java Chapter 3.
Basic Elements of C++ Chapter 2.
Programming Vocabulary.
2.1 Parts of a C++ Program.
CS150 Introduction to Computer Science 1
The C Programming Language
Introduction to C++ Introduced by Bjarne Stroustrup of AT&T’s Bell Laboratories in mid-1980’s Based on C C++ extended C to support object-oriented programming.
A programming language
Chapter 2: Introduction to C++.
Lecture Notes - Week 2 Lecture-1. Lecture Notes - Week 2 Lecture-1.
Presentation transcript:

CPS120: Introduction to Computer Science What We Know About C++ Lecture 8 - A

Characteristics of a C++ Program Comments Compiler Directives Functions Braces Statements Show MileFunc.cpp

A Simple C++ Program Comments //Simple C++ Program // // Purpose: To demonstrate the // parts of a simple C++ program Compiler Directive #include <iostream.h> Main Function main ( ) Braces { Statements cout << "This is a simple program "; return 0; }

Comments Explain the purpose of a program Keep notes regarding changes to source code Store details about the programmers for future reference Explain parts of the program

Sample Comments At the start of the program /************************************************** ** Miles Per Gallon ** ** Programmer: Paul J. Millis ** ** Purpose: Calculate mile per gallon and price per mile ** ** given miles, gallons and gas price ** *************************************************/ Within specific lines of code float PricePerMile = 0.00; //store the price per mile float MilesPerGallon = 0.0; //stores the miler per gallon achieved

Compiler Directives Instructions to the compiler rather than part of the C++ language Most common directive is #include For Example: #include <iostream.h> A .h file is a header file. It serves as a link between program code and standard C++ code needed to make programs run

Functions A function is a block of code that carries out a specific task Every C++ program has a main function that executes when a program initiates Includes open parenthesis to designate a function Ends with a return 0; statement

Braces Mark the beginning and ending of blocks of related code Every opening brace must have a closing brace

Statements Functions contain statements that consist of instructions or commands that make the program work

Semicolons There must be a semicolon after every statement To tell the compiler that the statement is complete Function definitions and compiler directives are exempt

C++ and Blank Space C++ allows for great flexibility in the spacing and layout of code Use this feature to make it easier for you as a human being to read the code

Uppercase or Lowercase Be careful to use the same combination of uppercase or lowercase lettering when you enter source code Commands and other reserved words are all lower case