Presentation is loading. Please wait.

Presentation is loading. Please wait.

INTRODUCTION C++ I. Elaf AlhazmiLAB1 Programming course.

Similar presentations


Presentation on theme: "INTRODUCTION C++ I. Elaf AlhazmiLAB1 Programming course."— Presentation transcript:

1 INTRODUCTION C++ I. Elaf AlhazmiLAB1 Programming course

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

3 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)

4 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)

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

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

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

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

9 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)

10 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)

11 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)

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

13 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)

14 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)

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

16 Operators and expressions - (-3* (5 +2 *6)) + (3* 4+4)/2 12 17 - 51 51 12 16 8 59 16 Ins. Elaf Alhazmi Computer Programming (lab)

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

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


Download ppt "INTRODUCTION C++ I. Elaf AlhazmiLAB1 Programming course."

Similar presentations


Ads by Google