Your SlideShare is downloading. ×
C++ programming
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

C++ programming

1,034

Published on

Published in: Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,034
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
64
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. C/C++
    • By
    • Abdallah Abuouf
    • 3 rd IT
    • [email_address]
  • 2. Agenda
    • Why c++
    • Basics
    • Pointer
    • Oop
    • Data structure
    • C/C++ under Linux
    • Create GUI by GTK+
    • C++ and netbeans
  • 3. Why C++ ?!!
    • Pointer -> The power
    • Oop -> Ease of understanding and clarity
    • Memory Controller -> Good but dangerous
    • All -> Fun and simple :)
  • 4. Basics
    • Data type
    • Commentes
    • Functions
    • Special symbols
  • 5. Data type
    • Int 4byte
    • Double 8byte
    • Float 4byte
    • Char 1byte
    • Bool 1byte true or false
  • 6. Functions
    • return_type function_name(args);
    • main(){
    • function_name();
    • }
    • return_type function_name(args)
    • {
    • //
    • }
  • 7. Another way
    • return_type function_name(args)
    • {
    • //statements
    • }
    • main(){
    • function_name();
    • }
  • 8. Special symbols
    • new line
    •  backspace
    • tab
    • start of line
    • a Bell sound
    • ' to print '
    • ” to print “
    • ? to print ?
  • 9. Conditions
    • If esle
    • Switch case
  • 10. If else
    • if(condition){
    • //statments
    • }
    • Else{
    • //statmets
    • }
  • 11. Switch case
    • switch c{
    • case a:
    • //statements;
    • break;
    • case b:
    • //statements;
    • break;
    • default:
    • //statements
    • break;
    • }
  • 12. Loops
    • For loop
    • While
    • Do while
    • Goto
    • Break & continue
  • 13. For loop
    • Nested for
    • for(int i=1;i<10;i++){
    • for(int j=1;j<=i;j++){
    • cout <<j<<” ”;
    • }
    • cout<<endl;
    • }
    • 1
    • 1 2
    • 1 2 3
    • 1 2 3 4
    • 1 2 3 4 5
    • 1 2 3 4 5 6
    • 1 2 3 4 5 6 7
    • 1 2 3 4 5 6 7 8
    • 1 2 3 4 5 6 7 8 9
  • 14. while
    • while(condition)
    • {
    • //statments
    • }
  • 15. Do while
    • {
    • //statmentes
    • }dowhile(condition)
  • 16. GO TO
    • a: //label
    • //statments
    • if(condition){
    • goto a;
    • }
  • 17. Pointer is very easy
    • int *xadd;
    • int x=7; --->(1)
    • int y=x; --->(2)
    • xadd=&x; -->(3)
    • cout<<x<<endl; -->(1)
    • cout<<y<<endl; -->(2)
    • cout<<xadd<<endl;(3)
    • cout<<*xadd<<endl;(3)
  • 18.
    • Data type *pointer _name;
    • pointer _name=&variable name
    • Data type &Reference _name=variable name;
    • ptr2 = (char*) ptr1;
    • converts ptr1 to char pointer before assigning it to ptr2.
  • 19. Pointer Ex
    • int x=5;
    • int y=105;
    • int *p1=&x;
    • int *p2=&y;
    • cout<<&quot; p1=&quot;<<p1<<&quot;p2=&quot;<<p2;
    • cout<<&quot; x= &quot;<<x<<&quot;y=&quot;<<y;
    • y=x;
    • cout<<&quot; p1=&quot;<<p1<<&quot;p2=&quot;<<p2;
    • cout<<&quot; x= &quot;<<x<<&quot;y=&quot;<<y;
    • x=10;
    • *p2=*p1;
    • cout<<&quot; p1=&quot;<<p1<<&quot;p2=&quot;<<p2;
    • cout<<&quot; x= &quot;<<x<<&quot;y=&quot;<<y;
    • Can be =null;
    • Can be redeclared
    • Deleted by delete
    • Delete p1;
    p1= 0x222 p2=0x223 X=5 y=105 p1= 0x222 p2=0x223 X=105 y=105 p1= 0x222 p2=0x222 X=10 y=10
  • 20. Reference Ex
    • int x=300;
    • int &ref=x;
    • cout<<&quot; x= &quot;<<x;
    • cout<<&quot; ref= &quot;<<ref;
    • ref=600;
    • cout<<&quot; x= &quot;<<xx;
    • cout<<&quot; ref= &quot;<<ref;
    • -----------------------
    • x=300 ref=300
    • X=600 ref=600
    • notes
    • Can't be=null;
    • Can't be redeclared
    • -----------------------
    • int &Ref= *(new int);
    • int x=99;
    • &Refr=x; //wrong
  • 21. Oop
    • Constractor & destractor
    • Class
    • Header file
  • 22. Demo
  • 23. Data structure
    • Array
    • Linked list
  • 24. Array
    • Data type array_name[size];
    • Multidimensional Arrays
    • Data type array_name[width,high];
  • 25. Linked list
    • Demo
  • 26. C/C++ under Linux
    • Install on debian family
    • sudo apt-get install gcc
    • Install on redhat family
    • yum -i gcc
    • Complie
    • gcc filename.cpp -o filename
    • Run
    • ./filename
  • 27. Make executable file
    • Change the extension of complied file to .sh
    • then click on it ,it will run
  • 28. Create GUI by GTK+
    • It's work under Linux and windows
    • Very beautiful
    • Free
    • examples
    • Gnome
    • Gimp
    • tutorial1
    • tutorial2
    • For c++ we use gtkmm
  • 29. C++ and netbeans Demo
  • 30.  
  • 31. References
    • Robert_Lafore-Object_Oriented_Programming_in_C++
    • Data Structures and Algorithm Analysis in C
    • http://www.brpreiss.com/books/opus4/html/book.html
    • http://cpp.datastructures.net/
  • 32. With best wishes Abuouf http://abuouf.wordpress.com [email_address]

×