0% found this document useful (0 votes)
6 views3 pages

History of C

C++ history

Uploaded by

landeparth93
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

History of C

C++ history

Uploaded by

landeparth93
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Early Development

 1979: C++ was developed by Bjarne Stroustrup at Bell Labs. Initially, it was an
extension of the C programming language, aimed at adding object-oriented features.
The first version was called "C with Classes."

The name "C++" reflects its evolution from the C programming language. The "C" part signifies
its foundation in C, while the "++" is a nod to the increment operator in C, symbolizing an
enhancement or an increase in capability. Essentially, the name suggests that C++ is "one
better than C," highlighting its improvements, particularly in object-oriented programming
features. This clever naming captures the idea of progression and development from C to a
more advanced language.

C++ has undergone several standardizations and updates since its inception. Here’s a brief
timeline of key versions and their replacements:

 C with Classes (1979): The initial version developed by Bjarne Stroustrup.


 C++ (1983): The language was officially named C++.
 C++98 (1998): The first official ISO standard, replacing earlier versions.
 C++03 (2003): A minor revision to address bugs in C++98, not a complete replacement
but an update.
 C++11 (2011): A major revision that introduced many new features, effectively
replacing C++03.
 C++14 (2014): A small update to C++11, refining and adding minor features.
 C++17 (2017): Another significant update, replacing C++14 with more substantial
enhancements.
 C++20 (2020): A major revision that introduced numerous new features and concepts.
 C++23 (2023): The latest standard, further evolving the language.

1. Preprocessor Directives

These are commands that provide instructions to the compiler before the actual compilation
starts. Common directives include:

cpp
Copy code
#include <iostream> // Includes the standard input-output stream library
#define PI 3.14 // Defines a constant

2. Namespace Declaration

Namespaces are used to organize code and avoid name conflicts. The standard namespace is
often used:

cpp
Copy code
using namespace std;

3. Function Declarations
You can declare functions before defining them, specifying their return types and parameters:

cpp
Copy code
void myFunction(int a); // Declaration

4. Main Function

Every C++ program must have a main function, which serves as the entry point:

cpp
Copy code
int main() {
// Code goes here
return 0; // Exit status
}

5. Variable Declarations

Variables can be declared within the main function or other functions:

cpp
Copy code
int num; // Integer variable
float average; // Floating-point variable

6. Control Structures

C++ supports various control structures, such as if statements, loops, and switch statements:

cpp
Copy code
if (num > 0) {
cout << "Positive";
} else {
cout << "Non-positive";
}

7. Function Definitions

Functions can be defined after the main function or in separate files:

cpp
Copy code
void myFunction(int a) {
cout << "Value: " << a;
}

8. Classes and Objects

C++ is an object-oriented language, so defining classes is common:

cpp
Copy code
class MyClass {
public:
int data;
void display() {
cout << data;
}
};

9. Comments

Comments are essential for documenting code:

cpp
Copy code
// This is a single-line comment
/*
This is a
multi-line comment
*/

Example Structure

Here’s a simple example that includes all these components:

cpp
Copy code
#include <iostream>
using namespace std;

void greet() {
cout << "Hello, World!" << endl;
}

int main() {
greet();
return 0;
}

You might also like