1 / 18

Introduction C++

Programming course. Introduction C++. I. Elaf Alhazmi LAB 1. Microsoft Visual Studio 2010 (Open New File). We will training on Microsoft Visual Studio 2010 for C++ program. Open Visual Studio 2010. Microsoft Visual Studio 2010 (Open New File). Open New project

varen
Télécharger la présentation

Introduction C++

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programming course Introduction C++ I. ElafAlhazmi LAB1

  2. Microsoft Visual Studio 2010(Open New File) • We will training on Microsoft Visual Studio 2010 for C++ program. • Open Visual Studio 2010 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 نكتب اسم المشروع Ins. Elaf Alhazmi Computer Programming (lab)

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

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

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

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

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

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

  10. Decleration • DataTypeVariable_Name = value/expression ; Initialization قيمة مبدئية int x; char grade; float PI=3.14; char yes= ‘y’; 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 StatementVariable = Expression ; • int x; • int is called data type • x is varible • Every variable in C++ program must be declared before it is used. Ins. Elaf Alhazmi Computer Programming (lab)

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

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

  15. Arithmetic operation Ins. Elaf Alhazmi Computer Programming (lab)

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

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

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

More Related