Introduction
C++ is the dominant language today for developing computer applications. This development takes place is on all platforms. C++ is an extension of C to support objected oriented programming. Therefore learning/using C++ implies familiarity with C too. C was developed by Dennis Ritchie , Bell Labs, in 1972. One of the significant uses of C was in the development of the different operating systems. An example is the Unix operating system which is written in C. Also most of the programs for the Unix system is written in C. One of the reasons that C became popular was that it could function as a low-level language where every algorithmic detail could be programmed, as well be used as a high level language which hides the details of the computer's architecture. In both of these instances programming efficiency generally increases.
In this programming course, the syntax adopted by Matlab is quite similar to C except for the lack of pointers ( we should come across pointers soon). The syntax in Java is very much like C++ except, once again, for the lack of pointers in Java. C/C++ is generally crptic and the code is usually not easy to read. The use of long descriptine names in Java provides some element of description, but the evolution of C in the past demanded a level of conciseness that makes the programs very terse.
The advantages of C( disadvantages ):
Code Size is small with fewer syntax rules and more operators than keywords
C has a very limited set of features/functions for basic operations on numbers and strings unlike other programming languages. It has no built in input/output capabilities. These processing capabilities are possible with a rich set of library functions which for the most part appear as part of the language itself. Consider the case that Java provides the capability to calculate powers of numbers using the Math.pow() function of the math library unlike the exponential operator in VB and Matlab.
The C code produced by most compilers are small and efficient. The closeness of C to the machine language as well as the resticted set of basic operations makes the code extermely fast
Limited Type Checking. This is also a disadvantage of C.
C supports modular programming whereby incremental compilation is possible
Allows bit-manipulation operators
Pointer data types - this is both a power feature and a curse. It allows you to directly address areas in memory. If not done carefully the program can fail. C permits pointer arithmetic.
Allows extensible structures - a specific collection of variables that holds particular information sets.
C is memory efficient. Uses few resources because of limited function support by the basic language. This could be a disadvantage because of lack of adequate run-time error checking
Portable across multiple paltforms
Many libraries providing all kinds of support functions are easiliy available.are available
Note: the word Objected Oriented programming language is missing above.
C++
C++ is a superset of the C language. It retains all of the advantages of C. At the same time it brings to C the support for Object Oriented Programming (OOP). It accomplishes this with simplicity while maintaining the compactness and execution efficiency of C [Pappas and Murray] . C++ was developed by Bjarne Stroustrup in the early 1980's. Like Java, C++ incorporated useful features from several contemporary languages of that time.
Among the primary evolutionary goal of C++ was to preserve the massive investment of effort in C, especially its debugged code, its libraries and tools. C++ was able to accomplish this while at the same time implementing stricter type checking and support for large-scale software development. Remember, it also allowed OOP.
Non-objected oriented enhancements to C:
C++ allows // Comment to end of line
Allows block scope. Variables can be introduced close to their actual use instead of at the begining
new scope reloution operator :: for differentiating global from local scope.
the const specifier to freeze the value within its scope. Same applies to pointers to that data
explicit type conversions
C++ allows overloading of functions - functions with same name but different parameters.
Default parameters for function calls
C++ allows functions with unknown number of parameters
reference argument types using the & operator
inline functions
new and delete keywords
void pointers
Object Oriented extension of C:
Class Construct with data and procedures with access modifiers
struct Class - a subset of class
Constructors and Destructors
Message/method invocation by an object
friend modifier for class
Operator overloading
Derived classes
Polymorphisn and Virtual functions
Stream library for input/output stream
Course Objectives
There are three areas we need to explore in the course.
Learn C++
Use C++ in an Objected-Oriented Manner
Use Visual C++ to create a Windows Application
We will use Microsoft Visual Studio(VS). We can exploit its Integrated Development Environment(IDE) and use its resources. While we do not need VS to learn C++ we nevertheless need a C++ compiler and a text editor . In RIT you have access to C++ compiler and a text editor on grace. It will be difficult to create a windows application however without some UI resources.
We will also try and remember many of the concepts we came across in VB, Matlab, and Java. C++ has a lot of features, What we can accomplish in this course will only be modest