Docstoc

C C 1 C ce153c Introduction2programming © 2006 NematAllah Ahmadyan

Document Sample
C C 1 C ce153c Introduction2programming © 2006 NematAllah Ahmadyan Powered By Docstoc
					C +        1         == C++


           ce153c
 Introduction2programming


      © 2006 NematAllah Ahmadyan.
History
   C was designed by Ritchi, Tompson,
    Kernighan
   It was fast, good & powerful

   but program’s maintance was a
    nightmare!
   Solution: ... Object-Oriented Programming
C++
   Object-Oriented
    •   Polymorphism
    •   Inheritance
    •   Encapsulation
   Data Abstraction
    •   Operator overloading
   STL { Standard Template Library }
   Templates
   streams

    Don’t Panic, They’ll become clear later!
What is C++ ?
   “C++ is a general purpose programming
    language with a bias towards systems
    programming that
    • is a better C,
    • supports data abstraction,
    • supports object oriented
    • programming, and
    • supports generic programming.”
            • By Bjarne Stroustrup
Hello, World & ...
1.    #include <iostream>
2.    #include <cmath>
3.    #include <iomanip>
4.    using namespace std;
5.    int main(){
6.              cout << “Hello,World” << endl ;
7.              int x = sin(6.28);
8.          cout << fixed << setprecision(5) << M_PI ;
9.          cout << scientific << x<< endl;
10.            return 0 ;
      }
Another piece of cake!
1.   ...                   1.   int f(int x){
2.   int x = 0 , y = 1;    2.         return x%2 ;
3.   cin >> x ;                 }
4.   if ( x == 1 ){
5.             y = f(3);         C++ is very similar to C
6.   }else{                       C is a mother nature!
7.             y = f(5);          To all other language.
                                 C++, Java even Matlab!
     }
Further readings
   A Brief Look at C++
    • Paper by Bjarne Stroustrup
   Addison Wesley - C++ Common Knowledge


   Advance Programming [Java] course ce244
    •   Lecturer: Ramtin Khosravi Ph.D
    •   Object-Oriented Programming
                       Books/Ebooks
   K&R C  Kernighan,Ritchie [ designers of C ]
   The C++ Programming Language 3rd Ed.
         •   Bjarne Stroustrup [ designer of C++ ]
   C Primer / C++ Primer
   C++ FAQ/ C++ FAQ Lite
   Dietel & Dietel C/C++/VC++/.NET
    •   How to program series
   Thinking in C++ Vol 1&2
   Effective C++ Vol 1&2
   McGraw-Hill - C & C++ Programmers Reference
   Ansi/ISO C++
   Numerical Recipes in C [ cambridge ]
   Scientific Calculation [ MathLab ] [ math department ]

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:14
posted:11/23/2011
language:
pages:10