Programming is instructing a computer to perform a task for you with the help of a programming language.

Slides:



Advertisements
Similar presentations
C++ Basics March 10th. A C++ program //if necessary include headers //#include void main() { //variable declaration //read values input from user //computation.
Advertisements

Introduction to C++ Programming. A Simple Program: Print a Line of Text // My First C++ Program #include int main( ) { cout
Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
1 11/3/08CS150 Introduction to Computer Science 1 Reading from and Writing to Files Section 3.12 & 13.1 & 13.5.
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.
Three types of computer languages
1 10/29/07CS150 Introduction to Computer Science 1 Reading from and Writing to Files Section 3.12 & 13.1 & 13.5.
CS31: Introduction to Computer Science I Discussion 1A 4/2/2010 Sungwon Yang
1 September 6, 2005CS150 Introduction to Computer Science I What Actions Do We Have Part 1 CS150 Introduction to Computer Science I.
1 8/30/06CS150 Introduction to Computer Science 1 Your First C++ Program.
1 10/25/06CS150 Introduction to Computer Science 1 Reading from and Writing to Files.
Basic Elements of C++ Chapter 2.
Arithmetic Operators Operation Operator Example Addition = 9 Subtraction = 1 and = -1 Multiplication * 5 * 4 = 9 Division (integer)
C++ Programming Language Day 1. What this course covers Day 1 – Structure of C++ program – Basic data types – Standard input, output streams – Selection.
Software Engineering 1 (Chap. 1) Object-Centered Design.
PRINCIPLES OF PROGRAMMING Revision. A Computer  A useful tool for solving a great variety of problems.  To make a computer do anything (i.e. solve.
VARIABLES, TYPES, INPUT/OUTPUT, ASSIGNMENT OPERATION Shieu-Hong Lin MATH/CS Department Chapel.
 2003 Prentice Hall, Inc. All rights reserved. 1 Introduction to C++ Programming Outline Introduction to C++ Programming A Simple Program: Printing a.
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.
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.
Current Assignments Homework 3 is due tonight. Iteration and basic functions. Exam 1 on Monday.
3. The Nuts and Bolts of C++ Computer Programming 3. The Nuts and Bolts of C++ 1 Learning the C++ language 3. The Nuts and Bolts of C++
Basic Elements of C++ Chapter 1.
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:
CHAPTER 7 DATA INPUT OUTPUT Prepared by: Lec. Ghader R. Kurdi.
First steps Jordi Cortadella Department of Computer Science.
THE BASICS OF A C++ PROGRAM EDP 4 / MATH 23 TTH 5:45 – 7:15.
CS Class 08 Today  Exercises  Nested loops  for statement  Built-in functions Announcements  Homework #3, group solution to in-class.
CSC1201: Programming Language 2 Lecture 1 Level 2 Course Nouf Aljaffan (C) CSC 1201 Course at KSU1.
Control Structures (B) Topics to cover here: Sequencing in C++ language.
1 A simple C++ program // ======================================================= // File:helloworld.cpp // Author:Vana Doufexi // Date:1/4/2006 // Description:Displays.
Chapter 2 part #1 C++ Program Structure
A first program 1. #include 2. using namespace std; 3. int main() { 4. cout
Introducing C++ Programming Lecture 3 Dr. Hebbat Allah A. Elwishy Computer & IS Assistant Professor
1 8/31/05CS150 Introduction to Computer Science 1 Hello World!
CHAPTER 1: INTRODUCTION C++ Programming. CS 241 Course URL: Text Book: C++ How to Program, DETITEL & DEITEL, eighth Edition.
CS1201: PROGRAMMING LANGUAGE 2 FUNCTIONS. OVERVIEW What is a Function? Function Prototype Vs Decleration Highlight Some Errors in Function Code Parameters.
1 Chapter-01 Introduction to Software Engineering.
 2003 Prentice Hall, Inc. All rights reserved Basics of a Typical C++ Environment C++ systems –Program-development environment –Language –C++
1 Structure of Simple C++ Program Chapter 1 09/09/13.
1 8/30/06CS150 Introduction to Computer Science 1 Your First C++ Program.
1 17/4/1435 h Monday Lecture 3 The Parts of a C++ Program.
C++ First Steps.
Chapter Topics The Basics of a C++ Program Data Types
Basic Elements of C++ Chapter 1.
Topic Pre-processor cout To output a message.
Engineering Problem Solving With C An Object Based Approach
What Actions Do We Have Part 1
ANNOUNCEMENT The missed lecture will be made up this Monday evening in the Tech PC classroom (MG51). A tentative time interval is 6:30-8:00. The exact.
LESSON 2 Basic of C++.
Chapter 2 part #1 C++ Program Structure
Basic Elements of C++.
CSCI 161: Introduction to Programming
Basic Elements of C++ Chapter 2.
Chapter 2 Elementary Programming
CS 1430: Programming in C++ Turn in your Quiz1-2 No time to cover HiC.
Programming Funamental slides
Programming Funamental slides
Mr. Dave Clausen La Cañada High School
Programs written in C and C++ can run on many different computers
Engineering Problem Solving with C++ An Object Based Approach
What Actions Do We Have Part 1
Capitolo 1 – Introduction C++ Programming
Reading from and Writing to Files
Computer Terms Review from what language did C++ originate?
Reading from and Writing to Files Part 2
Reading from and Writing to Files
Chapter 2 part #1 C++ Program Structure
Presentation transcript:

Programming is instructing a computer to perform a task for you with the help of a programming language.

LEGO MINDSTORMS

Programming on C++

A computer program (software) contains a sequence of instructions for a computer.One program is usually composed of three parts: Input part gets the data from an input device. Our programs, in the book, will get the data from keyboard or from a text file. Process part is the hardest working part of the program. It carries out the algorithm and finds out the desired result. Output part gives the result of the program. Our programs will display the result on the screen or print it into a text file.

OUR 1 st PROGRAM Program will write text on screen: START “Hello world!” END

#include using namespace std; int main() { cout <<"Hello world!"; system("pause"); return 0; }

each C++ statement ends with a semicolon character (';'). Writing comments in the program code- // OR /* */

#include //includes the declarations of the basic standard input-output //library in C++, and its functionality is going to be used later //in the program. using namespace std; //Namespaces are containers that contain the declarations of all //the elements of the standard C++ library int main() //the only function in this program. { cout <<"Hello world!"; //print "Hello world!". cout is //declared in the iostream standard //file within the std namespace system("pause"); //Wait until user hits a key and //displays a message return 0; //the main function ends properly }

START “5+3=“;5+3 END

#include using namespace std; int main() { cout <<"5 + 3 = "<<5+3<<endl; //calculate and print the sum system("pause"); return 0; }

Getting Data from the User (Input) "cin" command is used to read data from the standard input

Calculating sum of numbers START READ num1, num2 END Sum=num1+num2 PRINT Sum

#include using namespace std; int main() { int num1, num2, sum; //num1, num2 and sum are three //variables type of integer. cout<<"Enter two integers:"<<endl; cin >> num1 >> num2; //cin reads two values for //num1 and num2. sum = num1 + num2; //sum gets the value of num1+num2. cout <<"Sum is "<<sum<<endl; system("PAUSE"); return 0; }

HOMEWORK Make a program to calculate area and perimeter of a rectangle. Input: length of side1 and length of side2. Process: area = side1*side2 Perimeter = 2*(side1+side2) Output: area and perimeter