Skip to content

Commit 1ffa18e

Browse files
committed
commits switch to cpp-docs
1 parent e7ef3b5 commit 1ffa18e

File tree

7 files changed

+7
-377
lines changed

7 files changed

+7
-377
lines changed

docs/cpp/basic-syntax-and-structure/02_Variables_and_Data_Types.md

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -13,71 +13,4 @@ tags:
1313
c++ data types
1414
]
1515
description: In this tutorial, we will learn about variables and data types in C++. We will learn about what variables are, how to declare and initialize variables, and the different data types available in the language.
16-
---
17-
18-
# Variables and Data Types in C++
19-
20-
## Data Types
21-
22-
C++ is a strongly-typed language, meaning every variable must be declared with a data type.
23-
24-
### Primitive Data Types
25-
26-
- **int**: Integer type.
27-
- **double**: Double-precision floating point.
28-
- **char**: Character type.
29-
- **bool**: Boolean type (true or false).
30-
31-
Example:
32-
33-
```cpp
34-
int number = 10;
35-
double price = 9.99;
36-
char letter = 'A';
37-
bool isCppFun = true;
38-
```
39-
40-
### Derived Data Types
41-
42-
Derived data types are created from fundamental data types.
43-
44-
- **Array**: A collection of elements of the same data type.
45-
- **Pointer**: A variable that stores the memory address of another variable.
46-
- **Reference**: A reference to another variable, often used in functions.
47-
48-
Example:
49-
50-
```cpp
51-
int numbers[] = {1, 2, 3, 4, 5};
52-
int* ptr = &number;
53-
int& refNumber = number;
54-
```
55-
56-
## Variables
57-
58-
Variables store data values and must be declared before use.
59-
60-
### Variable Declaration
61-
62-
```cpp
63-
int age;
64-
char grade;
65-
```
66-
67-
### Variable Initialization
68-
69-
```cpp
70-
age = 25;
71-
grade = 'A';
72-
```
73-
74-
### Combined Declaration and Initialization
75-
76-
```cpp
77-
int age = 25;
78-
char grade = 'A';
79-
```
80-
81-
## Conclusion
82-
83-
Understanding C++ variables and data types is fundamental to writing efficient and effective C++ code. By mastering these concepts, you can work with different types of data and create dynamic and robust applications in C++.
16+
---

docs/cpp/basic-syntax-and-structure/03_Operators_and_Expressions.md

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -6,71 +6,4 @@ sidebar_position: 3
66
tags:
77
[c++, operators, expressions, programming, c++ operators, c++ expressions]
88
description: In this tutorial, we will learn about operators and expressions in C++. We will learn about the different types of operators available in C++, how to use them, and how to create expressions using operators.
9-
---
10-
11-
# Operators and Expressions in C++
12-
13-
## Operators
14-
15-
C++ supports various operators for arithmetic, comparison, logical operations, etc.
16-
17-
### Arithmetic Operators
18-
19-
- `+` (addition)
20-
- `-` (subtraction)
21-
- `*` (multiplication)
22-
- `/` (division)
23-
- `%` (modulus)
24-
25-
Example:
26-
27-
```cpp
28-
int sum = 10 + 5; // 15
29-
int difference = 10 - 5; // 5
30-
```
31-
32-
### Comparison Operators
33-
34-
- `==` (equal to)
35-
- `!=` (not equal to)
36-
- `>` (greater than)
37-
- `<` (less than)
38-
- `>=` (greater than or equal to)
39-
- `<=` (less than or equal to)
40-
41-
Example:
42-
43-
```cpp
44-
bool isEqual = (10 == 10); // true
45-
bool isGreater = (10 > 5); // true
46-
```
47-
48-
### Logical Operators
49-
50-
- `&&` (logical AND)
51-
- `||` (logical OR)
52-
- `!` (logical NOT)
53-
54-
Example:
55-
56-
```cpp
57-
bool result = (true && false); // false
58-
bool orResult = (true || false); // true
59-
```
60-
61-
## Expressions
62-
63-
Expressions in C++ are formed using operators and operands. An expression can be a combination of literals, variables, and operators.
64-
65-
Example:
66-
67-
```cpp
68-
int x = 10;
69-
int y = 5;
70-
int z = x + y; // z = 15
71-
bool isTrue = (x > y) && (z != y); // true
72-
```
73-
74-
## Conclusion
75-
76-
Understanding C++ operators and expressions is fundamental to writing effective C++ code. By mastering these concepts, you can perform various operations and create complex expressions in your C++ programs.
9+
---

docs/cpp/basic-syntax-and-structure/cpp-syntax-basics.md

Lines changed: 1 addition & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -14,89 +14,4 @@ tags:
1414
c++ features,
1515
]
1616
description: In this tutorial, we will learn about the syntax and structure of the C++ programming language. We will learn about the basic structure of a C++ program, C++ syntax, and the rules that govern the C++ programming language.
17-
---
18-
19-
# C++ Syntax and Structure
20-
21-
## Introduction
22-
23-
Understanding the basic syntax and structure of C++ is essential for writing effective C++ programs. This guide covers the fundamental elements of C++ syntax and how to structure a C++ program.
24-
25-
## Basic Syntax
26-
27-
### Hello World Example
28-
29-
The simplest C++ program is a "Hello, World!" application. Here's what it looks like:
30-
31-
```cpp
32-
#include <iostream>
33-
34-
int main() {
35-
std::cout << "Hello, World!" << std::endl;
36-
return 0;
37-
}
38-
```
39-
40-
### Explanation
41-
42-
- **Header File**: The `#include <iostream>` line includes the input/output stream library, allowing us to use `cout` and `endl`.
43-
- **Main Function**: The `main` function is the entry point of any C++ application. It returns an integer value (`int`) indicating the exit status.
44-
- **Output Statement**: The `std::cout << "Hello, World!" << std::endl;` statement prints the specified message to the console.
45-
46-
## Comments
47-
48-
Comments are used to explain code and are ignored by the compiler.
49-
50-
- **Single-line comments** start with `//`.
51-
52-
```cpp
53-
// This is a single-line comment
54-
```
55-
56-
- **Multi-line comments** are enclosed in `/* ... */`.
57-
58-
```cpp
59-
/*
60-
This is a multi-line comment
61-
that spans multiple lines.
62-
*/
63-
```
64-
65-
## Data Types and Variables
66-
67-
C++ supports various data types such as `int`, `double`, `char`, `bool`, etc., and allows the declaration of variables using the syntax `datatype variableName;`.
68-
69-
```cpp
70-
int age = 25;
71-
double salary = 50000.50;
72-
char grade = 'A';
73-
bool isEmployed = true;
74-
```
75-
76-
## Control Structures
77-
78-
C++ provides control structures like `if`, `else`, `for`, `while`, and `switch` for conditional and looping operations.
79-
80-
```cpp
81-
if (age >= 18) {
82-
std::cout << "You are an adult." << std::endl;
83-
} else {
84-
std::cout << "You are a minor." << std::endl;
85-
}
86-
```
87-
88-
## Functions
89-
90-
Functions in C++ are declared using the syntax `returnType functionName(parameters) { ... }`.
91-
92-
```cpp
93-
int add(int a, int b) {
94-
return a + b;
95-
}
96-
97-
int result = add(5, 10); // result = 15
98-
```
99-
100-
## Conclusion
101-
102-
Understanding the basic syntax and structure of C++ is foundational to becoming proficient in C++ programming. By mastering these concepts, you can write efficient and reliable C++ code for various applications.
17+
---

docs/cpp/home.md

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,4 @@ sidebar_label: Overview
55
sidebar_position: 1
66
tags: [C++, overview]
77
description: In this tutorial, you will learn about the C++ programming language, its features, and its applications.
8-
---
9-
10-
C++ is a high-level, general-purpose programming language that is widely used for developing system software, application software, game development, and more. It is an extension of the C programming language with additional features such as classes and objects, inheritance, polymorphism, and templates.
11-
12-
## What we will learn in this tutorial?
13-
14-
In this tutorial, you will learn about the C++ programming language, its features, and its applications. You will also learn how to set up a C++ development environment on your computer and write your first C++ program.
15-
16-
## What is C++?
17-
18-
- C++ is a high-level, general-purpose programming language.
19-
- It is an extension of the C programming language with additional features such as classes and objects, inheritance, polymorphism, and templates.
20-
- C++ is designed for system programming, application development, game development, and more.
21-
- It is a statically typed language, which means that variable types are checked at compile time.
22-
- C++ supports both procedural programming and object-oriented programming paradigms.
23-
- C++ code is typically compiled into machine code for execution.
24-
25-
## Features of C++
26-
27-
- **Object-Oriented**: C++ is an object-oriented programming language. It supports the concepts of classes and objects, inheritance, polymorphism, and encapsulation.
28-
- **Statically Typed**: C++ is a statically typed language, which means that variable types are checked at compile time.
29-
- **Compiled Language**: C++ code is compiled into machine code for execution, which can result in high performance.
30-
- **Portable**: C++ code can be compiled and executed on different platforms, making it portable.
31-
- **Memory Management**: C++ allows manual memory management using pointers, which gives developers more control over memory allocation and deallocation.
32-
- **Standard Library**: C++ provides a rich standard library that includes data structures, algorithms, input/output functions, and more.
33-
- **Compatibility with C**: C++ is compatible with C code, allowing developers to use existing C libraries and code in C++ programs.
34-
35-
## Applications of C++
36-
37-
C++ is used in a wide range of applications, including:
38-
39-
- **System Software**: C++ is used to develop system software such as operating systems, device drivers, and firmware.
40-
- **Application Software**: C++ is used to develop application software such as desktop applications, business applications, and productivity tools.
41-
- **Game Development**: C++ is widely used in game development. It is used to build game engines, game logic, and graphics rendering.
42-
- **Embedded Systems**: C++ is used in embedded systems development. It is used to build embedded software for devices such as microcontrollers, IoT devices, and automotive systems.
43-
- **High-Performance Computing**: C++ is used in high-performance computing (HPC) applications such as scientific computing, simulations, and data analysis.
44-
- **Graphics Programming**: C++ is used in graphics programming. It is used to develop graphics libraries, rendering engines, and graphical user interfaces (GUIs).
45-
- **Financial Applications**: C++ is used in financial applications such as trading systems, risk management software, and financial modeling tools.
46-
- **Compiler Development**: C++ is used to develop compilers, interpreters, and language tools for other programming languages.
47-
- **Networking**: C++ is used in networking applications such as network protocols, servers, and communication software.
48-
- **Artificial Intelligence**: C++ is used in artificial intelligence (AI) applications such as machine learning algorithms, neural networks, and AI research.
49-
- **Multimedia Applications**: C++ is used in multimedia applications such as audio/video processing, image processing, and media players.
50-
51-
## Conclusion
52-
53-
C++ is a powerful and versatile programming language that is widely used in various domains. It combines the features of procedural programming with object-oriented programming, making it suitable for a wide range of applications. Whether you are a beginner or an experienced developer, learning C++ can open up opportunities to work on exciting projects and technologies. In this tutorial, you will learn the basics of C++ programming and how to get started with C++ development. Let's dive in!
8+
---

docs/cpp/introduction-to-cpp/setting-up-your-cpp-environment.md

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,4 @@ sidebar_label: Setup C++ Development Environment
55
sidebar_position: 3
66
tags: [c++, setup c++ development environment]
77
description: In this tutorial, you will walk through all the steps of setting up a C++ development environment on your local computer.
8-
---
9-
10-
# Setting Up a C++ Environment
11-
12-
## Introduction
13-
14-
Before you can start programming in C++, you need to set up your development environment. This typically involves installing the necessary software and configuring your system to compile and run C++ code.
15-
16-
## Steps to Set Up C++ Environment
17-
18-
1. **Install a C++ Compiler**:
19-
20-
- For Windows, you can install MinGW or Microsoft Visual C++ Compiler.
21-
- For macOS, you can install Xcode Command Line Tools or use Homebrew to install GCC.
22-
- For Linux, you can use your package manager to install GCC or Clang.
23-
24-
2. **Choose a Text Editor or Integrated Development Environment (IDE)**:
25-
26-
- Choose a text editor like Visual Studio Code, Sublime Text, or Atom, or an IDE like Visual Studio or CLion for C++ development.
27-
- Download and install the chosen editor or IDE from their official websites.
28-
29-
3. **Set Up Compiler and Build Tools**:
30-
31-
- If using an IDE, configure it to use the installed C++ compiler (e.g., GCC or Clang).
32-
- For text editors, install C++ language support extensions or plugins for syntax highlighting and code completion.
33-
34-
4. **Install C++ Libraries and Frameworks** (Optional but recommended):
35-
36-
- Depending on your project requirements, install any necessary C++ libraries or frameworks like Boost, Qt, or OpenGL.
37-
- Configure your development environment to include these libraries in your project.
38-
39-
5. **Verify Installation**:
40-
41-
- Open a terminal or command prompt and type `g++ --version` (for GCC) or `clang++ --version` (for Clang) to verify that the C++ compiler is installed and accessible.
42-
43-
6. **Set Up Environment Variables** (Optional but recommended):
44-
45-
- Set up environment variables such as `PATH` to include the directory containing the C++ compiler and build tools, allowing you to run C++ commands from any directory in the terminal or command prompt.
46-
47-
## Conclusion
48-
49-
Setting up a C++ environment is crucial for C++ developers to compile, run, and manage C++ applications effectively. By following these steps and choosing the right tools for your needs, you can create a well-configured development environment that enhances your productivity and workflow when working with C++ code.
8+
---

docs/cpp/introduction-to-cpp/what-is-cpp.md

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,4 @@ sidebar_label: What is C++?
55
sidebar_position: 1
66
tags: [c++, what is c++, introduction to c++]
77
description: In this tutorial, you will learn about the C++ programming language, what it is, its features, and its applications.
8-
---
9-
10-
# Introduction to C++
11-
12-
## What is C++?
13-
14-
C++ is a powerful and widely-used programming language known for its versatility, performance, and extensive feature set. It is an extension of the C programming language with additional features such as classes and objects, inheritance, polymorphism, templates, and more. C++ is designed for system programming, application development, game development, and other domains.
15-
16-
## Key Features of C++
17-
18-
- **Object-Oriented**: C++ is an object-oriented programming (OOP) language, allowing developers to create classes and objects that encapsulate data and behavior.
19-
- **Statically Typed**: C++ is a statically typed language, meaning that variable types are checked at compile time for type safety.
20-
- **Compiled Language**: C++ code is compiled into machine code for execution, resulting in high performance and efficiency.
21-
- **Memory Management**: C++ allows manual memory management using pointers, giving developers control over memory allocation and deallocation.
22-
- **Standard Library**: C++ provides a rich standard library with data structures, algorithms, input/output functions, and more, facilitating software development.
23-
- **Compatibility with C**: C++ is compatible with C code, allowing developers to use existing C libraries and code in C++ programs.
24-
25-
## C++ Development Ecosystem
26-
27-
C++ has a comprehensive development ecosystem comprising various tools, libraries, and frameworks:
28-
29-
- **Integrated Development Environments (IDEs)**: Popular IDEs for C++ development include Visual Studio, Code::Blocks, and CLion, offering features like code completion, debugging, and project management.
30-
31-
- **Libraries and Frameworks**: C++ has numerous libraries and frameworks for different purposes, such as Boost for general-purpose programming, Qt for GUI development, and OpenGL for graphics programming.
32-
33-
- **Community Support**: C++ has a vibrant community of developers who contribute to open-source projects, share knowledge through forums and blogs, and provide support to fellow developers.
34-
35-
## C++ Editions
36-
37-
C++ has evolved over time, leading to different editions tailored for specific platforms and use cases:
38-
39-
- **Standard C++**: Also known as ISO C++, this is the standardized version of the language maintained by the International Organization for Standardization (ISO).
40-
41-
- **C++11, C++14, C++17, C++20**: These are versions of the language that introduce new features and improvements, enhancing productivity and code quality.
42-
43-
- **Embedded C++ (EC++)**: Optimized for embedded systems development, EC++ focuses on efficiency, low-level programming, and resource-constrained environments.
44-
45-
## Conclusion
46-
47-
C++ continues to be a preferred choice for developers due to its versatility, performance, and extensive ecosystem. Whether you are building system software, applications, games, or embedded systems, C++ offers the tools and capabilities to meet diverse development needs. Its object-oriented nature, strong memory management, and compatibility with C make it a robust and reliable language for a wide range of projects.
8+
---

0 commit comments

Comments
 (0)