Introduction To C/C++
image

• The C programming language was designed by Dennis Ritchie at Bell Laboratories in the early 1970s.Traditionally it is used for systems programming, though this may be changing in favor of C++.

– C++ extends C to include support for Object Oriented Programming and other features that facilitate large software development projects.C is not strictly a subset of C++, but it is possible to write “Clean C” that conforms to both the C++ and C standards.

    A C++ development environment includes:
  • System libraries and headers: a set of standard libraries and their header files. For example see /usr/include and glibc.
  • Application Source: application source and header files
  • Compiler: converts source to object code for a specific platform
Features Of C++
image
  • Variables, Types and Expressions
  • Functions and Procedural Abstraction
  • Files and Streams
  • Branch and Loop Statements
  • Arrays and Strings
Features OF C++
  • Variables, Types and Expressions
  • C++ supports a large number of data types. The built in or basic data types supported by C++ are integer, floating point and character. C++ also provides the data type bool for variables that can hold only the values True and false. more

  • Functions and Procedural Abstraction
  • A natural way to solve large problems is to break them down into a series of sub-problems, which can be solved more-or-less independently and then combined to arrive at a complete solution. In programming, this methodology reflects itself in the use of sub-programs, and in C++ all sub-programs are called functions.more

image
  • Files and Streams
  • File I/O in C++ works very similarly to normal I/O . There are 3 basic file I/O classes in C++: istream , ofstream , and fstream). These classes do file input, output, and input/output respectively. To use the file I/O classes, you will need to include the fstream.h header.more

  • Branch and Loop Statements
  • The simplest form of flow control in C++ is the branch statement. This instruction allows the program to decide which of two paths to take through C++ instructions, based on the results of a logical expression.

  • Arrays and Strings
  • The use of arrays permits us to set aside a group of memory locations (i.e. a group of variables) that we can then manipulate as a single entity, but that at the same time gives us direct access to any individual component.more

C++ Code
image

The following program prompts the user for the number of hours that each employee has worked. It is more natural to number employees from 1 to 6 than from 0 to 5, but it is important to remember that array indexes always start from 0. Hence the program subtracts 1 from each employee number to obtain the corresponding array index.

    #include
    using namespace std;
    const int NO_OF_EMPLOYEES = 6;
    typedef int Hours_array[NO_OF_EMPLOYEES];
    int main()
    { Hours_array hours;
    int count;
    for (count = 1 ; count <= NO_OF_EMPLOYEES ; count++)
    { cout << "Enter hours for employee number " << count << ": ";
    cin >> hours[count - 1];
    } return 0;
    }
Gallery
Free Flash

Bjarne Stroustrup, a Danish computer scientist, began his work on C++'s predecessor "C with Classes" in 1979.

Web Templates

The first edition of Stroustrup's book, The C++ Programming Language, was published in early 1986. After the release of Version 2.0 in 1989, C++ was rapidly acknowledged as a serious, useful language.

Contact Us

We are happy to answer any questions you have provide you with an estimate. Just send us a message in the form below.