ISLAMIC UNIVERSITY OF GAZA FACULTY OF ENGINEERING ISLAMIC UNIVERSITY OF GAZA FACULTY OF ENGINEERING Computer Programming Lab 1 Programming Basics By Eng.

Slides:



Advertisements
Similar presentations
Current Assignments Homework 1 due in 4 days (June 16 th ) Variables, mathematical and logical operators, input/output, and the “ if ” operator. Project.
Advertisements

C++ Basics March 10th. A C++ program //if necessary include headers //#include void main() { //variable declaration //read values input from user //computation.
Introduction to C++ Programming. A Simple Program: Print a Line of Text // My First C++ Program #include int main( ) { cout
CMPUT 101 Lab # 5 October 22, :00 – 17:00.
1 9/29/06CS150 Introduction to Computer Science 1 Loops Section Page 255.
1 9/17/07CS150 Introduction to Computer Science 1 Type Casting.
1 9/28/07CS150 Introduction to Computer Science 1 Loops section 5.2, 5.4, 5.7.
1 10/20/08CS150 Introduction to Computer Science 1 do/while and Nested Loops Section 5.5 & 5.11.
CS150 Introduction to Computer Science 1
1 9/1/06CS150 Introduction to Computer Science 1 What Data Do We Have? CS 150 Introduction to Computer Science I.
CS150 Introduction to Computer Science 1
1 September 6, 2005CS150 Introduction to Computer Science I What Actions Do We Have Part 1 CS150 Introduction to Computer Science I.
1 10/9/06CS150 Introduction to Computer Science 1 for Loops.
How Create a C++ Program. #include using namespace std; void main() { cout
C++ programming I Lab#3 Control Statements Instructor: Eng. Ruba A. Salamah Tuseday: 17/10/2010.
CS 117 Section 2 + KNET Computer accounts – ed to KNET students –Change password Homework 1 Lab Tutors –In lab for next 2 weeks –Will help you with.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 9 – Income Tax Calculator Application: Introducing.
1  Ex: Declare a variable to store user’s age: int age; Prompt the user to enter his/her age: printf (“ How old are you? “); Read / scan the entered value.
Programming is instructing a computer to perform a task for you with the help of a programming language.
Introduction to C++ Programming
Software Engineering 1 (Chap. 1) Object-Centered Design.
VARIABLES, TYPES, INPUT/OUTPUT, ASSIGNMENT OPERATION Shieu-Hong Lin MATH/CS Department Chapel.
CSCI 1730 January 17 th, 2012 © by Pearson Education, Inc. All Rights Reserved.
M. Taimoor Khan #include void main() { //This is my first C++ Program /* This program will display a string message on.
Chapter 3 Expressions and Interactivity Department of Computer Science Missouri State Univeristy.
1 CS 1430: Programming in C++. 2 Input: Input ends with -1 Sentinel-Controlled Loop Input: Input begins with.
1 C++ Programming Basics Chapter 2 Lecture CSIS 10A.
Input/Output in Java. Output To output to the command line, we use either System.out.print () or System.out.println() or System.out.printf() Examples.
CHAPTER 7 DATA INPUT OUTPUT Prepared by: Lec. Ghader R. Kurdi.
1 CS161 Introduction to Computer Science Topic #3.
First steps Jordi Cortadella Department of Computer Science.
N from what language did C++ originate? n what’s input, output device? n what’s main memory, memory location, memory address? n what’s a program, data?
Review the following : Flowcharting Variable declarations Output Input Arithmetic Calculations Conditional Statements Loops.
Control Structures (B) Topics to cover here: Sequencing in C++ language.
Basics of Most C++ Programs // Programmer: Clayton Price date: 9/4/ // File: fahr2celc.cpp 03. // Purpose:
Assignment statement and Arithmetic operation 1 The major part of data processing.
CS Class 03 Topics  Sequence statements Input Output Assignment  Expressions Read pages Read pages 40 – 49 for next time.
Data Types and Conversions, Input from the Keyboard If you can't write it down in English, you can't code it. -- Peter Halpern If you lie to the computer,
1 CS 1430: Programming in C++. 2 Input: Input ends with -1 Sentinel-Controlled Loop Input: Input begins with.
Dayu Zhang 9/10/2014 Lab03. Outline Brief Review of the 4 Steps in Hello.cpp Example Understand endl and \n Understand Comment Programming Exercise -
Lecture 7 Computer Programming -1-. Conditional Statements 1- if Statement. 2- if ….. else Statement. 3- switch.
Literals A literal (sometimes called a constant) is a symbol which evaluates to itself, i.e., it is what it appears to be. Examples: 5 int literal
Computer Programming 12 Mr. Jean March 5 th, 2014.
 2003 Prentice Hall, Inc. All rights reserved Basics of a Typical C++ Environment C++ systems –Program-development environment –Language –C++
1 st Semester Module2 Basic C# Concept อภิรักษ์ จันทร์สร้าง Aphirak Jansang Computer Engineering.
General Computer Science for Engineers CISC 106 Lecture 27 Dr. John Cavazos Computer and Information Sciences 04/27/2009.
1.3 ARITHMETIC OPERATIONS WITH SCALARS
What Actions Do We Have Part 1
Data Types and Conversions, Input from the Keyboard
Two-Dimensional Arrays Lesson xx
Computing Fundamentals
Chapter 2 Assignment and Interactive Input
A computer program is a sequence of computer commands.
CS149D Elements of Computer Science
Programming Funamental slides
Unary Operators ++ and --
Programming Funamental slides
Wednesday 09/23/13.
Conditional Statements
CS150 Introduction to Computer Science 1
Islamic University of Gaza
Engineering Problem Solving with C++ An Object Based Approach
Engineering Problem Solving with C++ An Object Based Approach
Life is Full of Alternatives
Using Script Files and Managing Data
CS150 Introduction to Computer Science 1
Using string type variables
USING ARRAYS IN MATLAB BUILT-IN MATH FUNCTIONS
Input-Output Stability
Presentation transcript:

ISLAMIC UNIVERSITY OF GAZA FACULTY OF ENGINEERING ISLAMIC UNIVERSITY OF GAZA FACULTY OF ENGINEERING Computer Programming Lab 1 Programming Basics By Eng. Ruba A. Salamah

Lab Objectives 1. Basic Input/Output Operations 2. Variables and Data types 3. Arithmetic Operations 4. Constants and Comments

Basic Input/Output Operations We use the command cout<<”String” to display a message on the console for example: cout<<"hello world"; We use the endl to start a new line for next time cout<<"hello"<<endl; We can use \n to get same effect: cout<<"hello \n";

Basic Input/Output Operations The operator << is used to concatenate data for output, for example to display the value of x and y each in a new line : int x=5; int y=6; cout<<"The Value of x is "<< x << endl <<"and the value of y is "<<y<<endl;

Basic Input/Output Operations On the other hand, to get input from user use the cin>>x command to receive input from user: int x; cout<<”Please enter the value of x”<<endl; cin>>x; As you notice the user should be prompted to enter an input User Prompt

Lab work #1 Write a program to display the following output using a single cout statement.

Variable Types

Lab work # 2

Arithmetic Operators

Shorthand Assignment Operators:

Lab work #3

Lab work #4

Homework

Homework

END OF THE LAB Good Luck