210 likes | 253 Views
This guide explores the C++ programming language as an extension of C, covering object-oriented programming, data structures, syntax, and principles. Includes exercises in various file formats and a list of recommended resources.
E N D
Programming Language C++ Extension of C Dan Ophir, Ph.D. Cell.: 052-551359 e-Mail: comp_ophir@yahoo.com Electrical Engineering
Requirements • Tests: • Intermediate, • Final. 66% Lectures + 33% Exercises Note = Tests + Exercises Exercises in diskettes 1. .rtf format (Office); 2. .c, .cpp, .h, .hpp source 3. dsp, .exe 4. .zip Assistance: Mr. Roman Yavich Rom778@ua.fm cell.: 052-399539
Exercise 1 exercise1.doc
Conventions • blue – link • red – a reserved word. • > - pressing on a menu, sub-menu, button
C++ Object Oriented Programming Language
Syllabus C++ Environment – User Interface: Visual C++ מחלקות ,(classes) מבני נתונים : מחסניות, תורים, רשימות מקושרות, עצים וערימות. שיטות חיפוש ומיון נתונים. תכנות מונחה עצמים ;(Object Oriented) תחביר של שפת .C++ עקרונות של תכנות מונחה עצמים: כמוס ,(Encapsulation) רב צורתיות (Polymorphism) (Inheritance).
Bibliography • C++ Pocket book, Conor Sexton, Newnes (1996), • How to ProgramC, C++ and Java, Deitel & Deitel, Prentice Hall, 2000; • MSDN – Microsoft Design Network; • The C Programming Language; Brian W. Kerighean Dennis M. Ritchie Murray; Hill 1988; • http://www.cprogramming.com/tutorial.html • Object Oriented Programming , C++ושפת, אמיר קירש, Taskil Systems Ltd., 2001; • "שפת C++ כשפת אם", גרובר, "הוד עמי";
Work environment Work- Space Files Desktop Windows H:\Shomron\myCPP\hello\hello.dsw
C++ Workspace/Project Open B A C File>New>Workspace File>New>Project D (console) Close File>Save Workspace Save All Close Workspace
C++ Source A File>Open Workspace C File>New B D File>Open
C++ Compilation/Execution File>Open Workspace>Compile Build Execute (!)
C++ Help (MSDN) help for
Variables • Naming rules: • letters, digits, _ • Not case sensitive • Starting with a letter
Keywords (C, C++) C (32) auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static strict switch typede unsigned void volatile while C++ (11) class delete friend inline new operator private protected public template virtual
Fibonnaci 1 1 2 3 5 8 13 21… Converges to the golden ratio. AB : CB = CB : AC A B C
Golden Ratio Parthenon
C Example #include <stdio.h> #include <conio.h> void main(void) // Fibionnaci { int a[20]; int i; a[0]=1; a[1]=1; for(i=2;i<20;i++) { a[i]=a[i-1]+a[i-2]; printf("Fibionnaci[%d]=%d \n",i,a[i]); } }