INTRODUCTION C++ I. Elaf AlhazmiLAB1 Programming course.

Slides:



Advertisements
Similar presentations
Javascript Essentials How do I write it??  Start Homesite  Between the start and end BODY tags type: 
Advertisements

CSE202: Lecture 2The Ohio State University1 Variables and C++ Data Types.
© 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5/e Starting Out with C++: Early Objects 5 th Edition Chapter 2 Introduction.
1 9/20/06CS150 Introduction to Computer Science 1 Review: Exam 1.
1 9/08/06CS150 Introduction to Computer Science 1 Arithmetic Operators.
Data types and variables
How Create a C++ Program. #include using namespace std; void main() { cout
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 27, 2005.
CS150 Introduction to Computer Science 1
Chapter 2 Data Types, Declarations, and Displays
Chapter 2: Introduction to C++.
Introduction To C++ Programming 1.0 Basic C++ Program Structure 2.0 Program Control 3.0 Array And Structures 4.0 Function 5.0 Pointer 6.0 Secure Programming.
VARIABLES, TYPES, INPUT/OUTPUT, ASSIGNMENT OPERATION Shieu-Hong Lin MATH/CS Department Chapel.
Chapter 2 Data Types, Declarations, and Displays.
Objectives You should be able to describe: Data Types
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Outline Variables 1.
CSC 125 Introduction to C++ Programming Chapter 2 Introduction to C++
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2: Introduction to C++ Starting Out with C++ Early Objects Seventh.
Copyright 2006 Addison-Wesley Brief Version of Starting Out with C++ Chapter 2 Introduction to C++
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
Arithmetic Operations. Review function statement input/output comment #include data type variable identifier constant declaration.
Knowledge Base C++ #include using std namespace; int main(){} return 0 ; cout
CSE1222: Lecture 2The Ohio State University1. mathExample2.cpp // math example #include using namespace std; int main() { cout
1 INTRODUCTION TO PROBLEM SOLVING AND PROGRAMMING.
Copyright © 2012 Pearson Education, Inc. Chapter 2: Introduction to C++
CSC 107 – Programming For Science. Announcements  Memorization is not important, but…  … you will all still be responsible for information  Instead.
Course Title: Object Oriented Programming with C++ instructor ADEEL ANJUM Chapter No: 03 Conditional statement 1 BY ADEEL ANJUM (MSc-cs, CCNA,WEB DEVELOPER)
CP104 Introduction to Programming Overview of C Lecture 4__ 1 Assignment Statements An assignment statement is to store a value in a variable variable.
BASICS CONCEPTS OF ‘C’.  C Character Set C Character Set  Tokens in C Tokens in C  Constants Constants  Variables Variables  Global Variables Global.
CSC 107 – Programming For Science. The Week’s Goal.
THE BASICS OF A C++ PROGRAM EDP 4 / MATH 23 TTH 5:45 – 7:15.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 2: Introduction to C++
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2: Introduction to C++ Starting Out with C++ Early Objects Sixth.
CSC 107 – Programming For Science. Announcements.
Data Types Declarations Expressions Data storage C++ Basics.
CHAPTER 2 C++ SYNTAX & SEMANTICS #include using namespace std; int main() { cout
1 More data types Character and String –Non-numeric variables –Examples: char orange; String something; –orange and something are variable names –Note.
Chapter 2: Introduction to C++. Outline Basic “Hello World!!” Variables Data Types Illustration.
PROGRAM ESSENTIALS. TOKENS  SMALLEST UNITS OF A PROGRAM LANGUAGE  Special Symbols  Mathematical Operators  Punctuation  Word Symbols  Key Words.
Chapter 3 – Variables and Arithmetic Operations. First Program – volume of a box /************************************************************/ /* Program.
12/14/2016CS150 Introduction to Computer Science 1 Announcements  Website is up!   All lecture slides, assignments,
CS201 Introduction to Sabancı University 1 Chapter 2 Writing and Understanding C++ l Writing programs in any language requires understanding.
1 CSC 1111 Introduction to Computing using C++ C++ Basics (Part 1)
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Introduction to C++
Arithmetic Operations (L05) * Arithmetic Operations * Variables * Declaration Statement * Software Development Procedure Problem Solving Using C Dr. Ming.
A Sample Program #include using namespace std; int main(void) { cout
1 09/10/04CS150 Introduction to Computer Science 1 What Actions Do We Have Part 2.
What will each of the following lines print? System.out.println("number" ); number645 System.out.println("number" + (6 + 4)+ 5); number105 System.out.println(6.
CSC Programming for Science Lecture 5: Actual Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
2.1 The Part of a C++ Program. The Parts of a C++ Program // sample C++ program #include using namespace std; int main() { cout
LESSON 06.
Chapter 2: Introduction to C++
BASIC ELEMENTS OF A COMPUTER PROGRAM
Visual Basic Variables
Completing the Problem-Solving Process
Variables A variable is a placeholder for a value. It is a named memory location where that value is stored. Use the name of a variable to access or update.
ITEC113 Algorithms and Programming Techniques
Chapter 2 Elementary Programming
2.1 Parts of a C++ Program.
CS150 Introduction to Computer Science 1
Arrays Syntax: type variableName[size];
Lab 1 Introduction to C++.
CS150 Introduction to Computer Science 1
Chapter 2: Introduction to C++.
Engineering Problem Solving with C++ An Object Based Approach
Engineering Problem Solving with C++ An Object Based Approach
C Programming Lecture-3 Keywords, Datatypes, Constants & Variables
Presentation transcript:

INTRODUCTION C++ I. Elaf AlhazmiLAB1 Programming course

Microsoft Visual Studio 2010 (Open New File)  We will training on Microsoft Visual Studio 2010 for C++ program.  Open Visual Studio Ins. Elaf Alhazmi Computer Programming (lab)

Microsoft Visual Studio 2010 (Open New File)  Open New project  Then win32 then Win32 Conslot project  Or Empty Project if available نكتب اسم المشروع 3 Ins. Elaf Alhazmi Computer Programming (lab)

Microsoft Visual Studio 2010 (Open New File) نختار “Application Setting In case you select win32 then Win32 Conslot project then Application Setting 4 Ins. Elaf Alhazmi Computer Programming (lab)

Microsoft Visual Studio 2010 (Open New File) 1 - نختار “Empty project” 2 - نختار “Finish” 5 Ins. Elaf Alhazmi Computer Programming (lab)

Microsoft Visual Studio 2010 (Open New File) ضغط بزر اليمين في الفأرة على مجلد Source file ثم Add ثم New item 6 Ins. Elaf Alhazmi Computer Programming (lab)

Microsoft Visual Studio 2010 (Open New File) 1- نختار “C++ File (.cpp) “ 2 - نكتب إسم الملف 3 - نختار ”Add 7 Ins. Elaf Alhazmi Computer Programming (lab)

Microsoft Visual Studio 2010 (Open New File) نكتب الكود معرفة الاخطاء نختار Start Debugging 8 Ins. Elaf Alhazmi Computer Programming (lab)

Program 1 // my first program in C++ #include using namespace std; int main() { cout<< "Hello World!“ ; system("pause"); return 0; } 9 Ins. Elaf Alhazmi Computer Programming (lab)

Decleration  DataType Variable_Name = value/expression ; Initialization قيمة مبدئية int x; char grade; float PI=3.14; char yes= ‘y’; 10 Ins. Elaf Alhazmi Computer Programming (lab)

Declarations (Variables)  Variable is symbol that represents storage location in the computer’s memory. The information that is stored in that location is called Value  Assignment Statement Variable = Expression ;  int x;  int is called data type  x is varible  Every variable in C++ program must be declared before it is used. 11 Ins. Elaf Alhazmi Computer Programming (lab)

Variables name شروط تسمية المتغير  لا يمكن أن يبدأ المتغير بأي حرف غير الحروف الأبجدية (A-Z a-z) أو حرف التسطير السفلي (_), لكن الأحرف من الثاني وصاعدا يمكن أن تكون أعدادا أو أحرف أو حرف التسطير السفلي  لا يمكن أن يحتوي اسم المتغير على فراغات أو علامات تنقيط غير حرف التسطير (_)  لا يمكن أن يكون كلمة محجوزة Reserved word  لا يمكن أن يكون هناك متغيران بنفس الاسم  الأفضل أن يكون اسم المتغير ذا معنى لتسهيل البرمجة 12 Ins. Elaf Alhazmi Computer Programming (lab)

Reserved words  The syntax rules (or grammar) of C++ define certain symbols to have a unique meaning within a C++ program, must not be used for any other purposes unsignedstructshortintfloatdoubleconstauto voidswitchsignedlongforelsecontinuebreak volatiletypedefsizeofregistergotoenumdefaultcase whileunionstaticreturnifexterndochar 13 Ins. Elaf Alhazmi Computer Programming (lab)

Data types  String  String note: you need #include  Characters  Char  Integer Numbers  short  int  long  unsigned short  unsigned int  unsigned long  Real/ Float Numbers  float  double  long double 14 Ins. Elaf Alhazmi Computer Programming (lab)

Arithmetic operation SymbolAction =Assignment +Addition -Subtraction *Multiplication /Division %Modulus ( باقي القسمة ) 15 Ins. Elaf Alhazmi Computer Programming (lab)

Operators and expressions - (-3* (5 +2 *6)) + (3* 4+4)/ Ins. Elaf Alhazmi Computer Programming (lab)

Operators and Expressions  Priority الأفضلية من الأعلى إلى الأقل  the execution of an expression is from left to right  ( )   Negative sign  *, /  -, + 17 Ins. Elaf Alhazmi Computer Programming (lab)

Declarations & initialization Just declaration Declaration and initialization 18 Ins. Elaf Alhazmi Computer Programming (lab)