Comparing and Contrasting C and C++
Developed by Dennis Ritchie at AT&T Bell Laboratories in 1978, C was the language by choice of computer programmers for many years. As the industry began to starve for new technologies, a certain programmer named Bjarne Stroustrup at AT&T Bell Labs in Murray Hill, New Jersey felt the need to answer.The C language was fairly new and had only been around for about 5 years. However, there was something missing from it. "A simulation language with the features of object-oriented language" was what was missing (Stevens xvii). Since C was already well established, "Dr. Stroustrup made an historic decision: He elected to develop the C++ language system as a translator program that processes C++ source language into C language. The translated C source language could then be compiled on any computer system that supports C" (Stevens xviii). He called his translator program CFRONT. CFRONT was used largely in the development and early stages of the C++ language until the development of the Visual C++ language. The major difference in the C and C++ languages is that C++ supports object-oriented programming (OOP) and C does not. This was the major concern for the development of the C++ language in the fir
st place. Although most people have a misconception that object-oriented programming allows the user's programs to look better or help them to code easier, object-oriented programming has nothing to do with the visual things we see. It is a new way of "programming in which programs are constructed using classes" (Corica 2-1). There are also three features within object-oriented programming that set C++ apart from C. First in C++, encapsulation is incorporated which prevents the user from manipulating the internal representation in illegal ways. This feature is not existent in C which has very little checking built in. Second in C++, inheritance allows an object to inherit all variables and functions from another object. C does not have this feature because it is not built upon the ide! This program basically from the main() function calls the show() function and passes it 3 variables. In the function header, these values passed get assigned to local variables and then get printed out. When it comes to coding between the two languages, the general formatting and syntax are almost identical to each other. On the other hand, the functions in C++ that perform most basic routines are far different in names from those of C. Let's take the simple "Hello World" program for example. In C, the program is very basic and looks like this: Line 2: First = 5 Second = 2.3 Third = 4 Corica, Tim, & Beth Brown, Bruce Presley. A Guide to Programming in C++. Lawrenceville Press. 1997. show(9, 10.11, 12); // provide all 3 parameters
Some common words found in the essay are:
Output Line, Hello World, Visual C++, C++ Recently, C++ Notice, Third C++, Institute ANSI/ISO, Future C++, OUTPUT Line, Dr Stroustrup, c++ language, object-oriented programming, third =, = %d, void showint, = 4, main function, showint float int, void main, traditional c++, 1 =, third = 4, void showint float, = 4 line, = %21f printfthird,
Approximate Word count = 1365
Approximate Pages = 5 (250 words per page double spaced)
|