Presentation is loading. Please wait.

Presentation is loading. Please wait.

LECTURE 4 التعامل مع VISUAL C++ 2008 + المفاهيم الاساسية في البرمجة.

Similar presentations


Presentation on theme: "LECTURE 4 التعامل مع VISUAL C++ 2008 + المفاهيم الاساسية في البرمجة."— Presentation transcript:

1 LECTURE 4 التعامل مع VISUAL C++ 2008 + المفاهيم الاساسية في البرمجة

2 طريقة تثبيت Visual C++ 2008 1 2  أدخلي السيدي ثم قومي بالاتي : Tr.Hadeel@hotmail.com 2

3 طريقة تثبيت Visual C++ 2008 3 4 5   Tr.Hadeel@hotmail.com 3

4 طريقة تثبيت Visual C++ 2008 6 7 8  Tr.Hadeel@hotmail.com 4

5 طريقة تثبيت Visual C++ 2008 9 10  Tr.Hadeel@hotmail.com 5

6 طريقة فتح مشروع في visual C++ 2008   34 5 6 Tr.Hadeel@hotmail.com 6

7  7

8 بالزر اليمين على اسم البروجكت 11 12 تابع  13 14 15 16 Tr.Hadeel@hotmail.com 8

9 Terms : 9  Source code  Program in a form suitable for reading and writing by a human being  Executable program (executable)  Program in a form suitable for running on a computer  Compilation  Process of translating source code into object code  Compiler  Program that performs compilation as defined above Tr.Hadeel@hotmail.com

10 How to Write a Program 10 1) Define the problem precisely 2) Find and/or create the algorithms that will solve the problem 3) Use a C++ Editor to implement the algorithm to obtain the source code 4) Use the Compiler to  Check correctness of source code  If No errors, Translate source code into executable program (object code with machine language ) 5) The user runs the resulting executable program on a computer Tr.Hadeel@hotmail.com

11 Editor Source Code Tr.Hadeel@hotmail.com 11

12 طريقة تنفيذ الكود Tr.Hadeel@hotmail.com 12

13 تابع دلالة على خلو البرنامج من الاخطاء Tr.Hadeel@hotmail.com 13

14  Tr.Hadeel@hotmail.com 14

15 Typical C++ Environment المراحل التي يمر بها كود C++ قبل تنفيذه : وهو جزء من بيئة برمجة متكاملة, يكون اسم البرنامج مكون من جزئين الاول يكون المبرمج حرا في اختياره والثاني هو الامتداد فلا بد ان يكون ((.cpp, مثلا : student.cpp. يسمى الكود في هذه المرحلة بالكود المصدري (source code ) يقوم compiler بترجمة البرنامج إلى لغة الآله لينتج لنا الكود الموجه للآلة object code ) ) مثلا : student.obj يقوم به الرابط linker بعدها تنتج لدينا نسخة من البرنامج قابلة للتنفيذ مثلا : student.exe المرحلة السادسة, التنفيذ, executing : أخر خطوة, يأتي دور الـ cpu, حيث يقوم بتفيذ الكود, حيث يقوم تنفيذ تعليمة واحدة في كل مرة. editor preprocessor compiler linker Tr.Hadeel@hotmail.com 15

16 More Details 16  Source code Vs. object code  refer to the "before" and "after" versions of a computer program that is compiled before it is ready to run in a computer  To write C++ programs  a text editor (Notepad) or a visual programming tool is needed  The object code file  contains a sequence of instructions that the processor can understand but that is difficult for a human to read or modify. Tr.Hadeel@hotmail.com

17 Standard Library  Rich collections of existing code that can be reused in your applications  Common math calculations e.g. sqrt, pow …etc  String / character manipulations  Date / Time functions  Input / output  Error checking  Provided as part of C++ development environment  You can use their capabilities by referring to the corresponding header file that certain library defined in 17 Tr.Hadeel@hotmail.com 17

18 iostream Library  Part of the C++ Standard Library  Provides a uniform way of handling input from and output to predefined sources  Based on the concept of a "stream " 18 Tr.Hadeel@hotmail.com 18

19 Streams  Pre-connected input and output channels between a computer program and its environment when it begins execution  A stream is an object where a program can either insert or extract characters to or from it  Streams are generally associated to a physical source or destination of characters  a disk file, the keyboard, or the screen 19 Tr.Hadeel@hotmail.com 19

20 Streams (cont.)  Two types  Input streams are used to hold input from a data producer, such as a keyboard, a file  Output streams are used to hold output for a particular data consumer, such as a monitor, a file, or a printer  Programmer only has to learn how to interact with the streams  Details about how the stream interacts with the actual devices is left up to the environment or operating system 20 Tr.Hadeel@hotmail.com 20

21 Streams (cont.)  Standard Input Stream ( cin )  Standard Output Stream ( cout )  Standard Error Stream ( cerr ) 21 program keyboard screen cin cout cerr Tr.Hadeel@hotmail.com 21

22 cin and cout 22  Think of cout as a variable that accepts all data bound for standard output  Think of cin as a variable that accepts all data bound for standard input  The cout and cin declarations and definitions are located in the header file “ iostream ”  All of the Standard C++ libraries are wrapped in a single namespace std “standard” Tr.Hadeel@hotmail.com 22

23 Common Errors  Syntax (compilation) Errors  encountered during compilation  occurs when an instruction does not follow the syntax rules of the programming language e.g. forgetting a semicolon  Logic (Semantic) Errors  Not detected during compilation  produces unintended or undesired results e.g. forgetting to initialize a sum variable 23 Tr.Hadeel@hotmail.com 23

24 Common Errors (cont.)  Runtime (Execution-time) Errors  occurs during the execution of a program  May sometimes cause the program to crash e.g. division by zero 24 Tr.Hadeel@hotmail.com 24

25 end Tr.Hadeel@hotmail.com 25


Download ppt "LECTURE 4 التعامل مع VISUAL C++ 2008 + المفاهيم الاساسية في البرمجة."

Similar presentations


Ads by Google