Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nomandhoni-cs/mycplusplusjourney
In this Repository I will publish my basic C++ code
https://github.com/nomandhoni-cs/mycplusplusjourney
Last synced: 19 days ago
JSON representation
In this Repository I will publish my basic C++ code
- Host: GitHub
- URL: https://github.com/nomandhoni-cs/mycplusplusjourney
- Owner: nomandhoni-cs
- Created: 2022-01-13T07:58:24.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-10-17T11:57:02.000Z (about 2 years ago)
- Last Synced: 2024-10-07T03:20:22.643Z (about 1 month ago)
- Language: C++
- Size: 38.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# myCplusplusJourney
In this Repository I will publish my basic C++ code## A huge thanks to GitHub Copilot to helping me to comment inside of code
### Table of Contents
**[Introduction to C++](#introduction-to-c++)**
# Introduction to C++
##### Low level Programming Language
That means C++ programs run close to hardware, C++ is commonly used in operating system. You can access the memory by function and use pointer.
##### Speed of Execution
C++ doesn't come with garbage collection like Java and Python does also C++ does not use interpreter that's why C++ gives us a speedy runtime.
##### Derived from C
C was the language before C++ to write close to hardware program, but C didn't had OOP that's why C++ came in.
##### Richer library than C
C++ offers more libary than C, it offers one of the great libary called STL (Standard Template Libbary) which can be used in CP and software development.
##### Object Oriented Programming
C++ Offers you to do Object Oriented Programming and that's why this is called C++.### Basics
- Learned about buffer: If you press input `10 11` like this in a space between, the program will take the value of first variable 10 and second variable will take value 11.
- `sizeof()` operator gives you how much byte is a variable in a compiler.
- Unary Operator `++` here
``` int x = 10; int z = x++; cout << x << " " << z; // 11 10 ```
above `z = x++` means `z = x; x = x + 1;`
``` int x = 10; int z = ++x; cout << x << " " << z; // 12 12 ```
above `z = ++x` means ` x = x + 1; z = x;`
- `static_castx/y`
```
int main
{
int x = 10, y = 20
double z = x / y;
cout << z; // 0
}
```
in avobe code output will be 0 when operation between the integer then It will give integer output.
if you want to solve that problem you have to use this.
``` double z = static_cast x / y;```
or you can use
``` double z = (double) x/y``` to get output 0.5
- `+=` Operator here `x += 10` means
`x = x + 10;` and you can use `*=, /=, -=` like same way as above.
- Coma operator `,`
```
{
int x = 1, y = 2, z = 3, a;
a = (x, y, z);
cout << a; // 3
return 0;
}
```
Here `,` operator runs for left to right and it compares and first 2 value and it assiggn itself the second value.