Giter Site home page Giter Site logo

journey-to-learn-cpp's Introduction

Journey-To-Learn-CPP

๐Ÿง‘โ€๐Ÿ’ป

Resources :

Udemy Course : https://www.udemy.com/course/beginning-c-plus-plus-programming/learn/lecture/9535214#overview

Day 01

- Downloaded Codelite (64bit) compiler
- Curriculum Overview : https://github.com/Coollaitar/Journey-To-Learn-CPP/blob/main/Beginning%20C%2B%2B%20Programming%20-%20From%20Beginner%20to%20Beyond%20_%20Udemy%20-%20Google%20Chrome%2001-08-2022%2008_51_10.png
- Learnt how to add user input while printing the output in between of text.
- Learnt how to get input from user by just separating it by spaces.
- Completed 5 sections of the course and practiced some basic codes.
- Learnt how to get user input and how to print the output using cin and cout.
- Will be starting with Variables and Constants from tommorow.

Day 02

- Section 6 (Variables and Constants)
- Learnt About Signed and Unsigned datatypes
- Use #include library for printing max and min values of dataTypes
- Learnt use of Constants(const) before variables
- Section 7 (Arrays and Vectors)
- Accessing and Intializing Vectors
- Intializing 2D vectors
- Once pushed_back value of vector does not change
- Example of above with a code - https://github.com/Coollaitar/Journey-To-Learn-CPP/blob/main/Day%2002/day02.md#section-challenge-section-7-
- push_back is used to add elements in vectors at the end
- .size() is used to print size of vector
- .at() is used to print or take input at particular index of vector
- #include vector is used while coding with vectors
- vector variable_name {} or () : used for declaring vector
- Will be starting with section 8 ( Statements and Operators ) tommorow

Day 03

- Starting with Section 8 (Statements and Operators)
- Made A Rupees to Dollar converter
- Increment and Decrement operator
- Difference between pre and post Increment or Decrement
- Mixed Expression and Conversion
- Use of static_cast<> in printing
- Equality Operator "==" or "!="
- Use cout<<boolalpha to get output in boolean format
- Logical Operator (
- Section Challenge Code - https://github.com/Coollaitar/Journey-To-Learn-CPP/blob/main/Day%2003/day03.md#4-section-challenge-section-8-
- Completed Section 8
- Starting with Section 9 from tommorow

Day 04

- Started with Section 9 (Controlling Program Flow)
- If statement
- If-Else statement
- Nested If Statements
- Switch-Case statement and Enumeration
- Conditional Operator
- Looping
- For Loop
- Range Based For Loop
- #include (iomanip) , cout<<fixed<<setprecision(1);
- for(auto i : vec)
- size_t is an unsigned int
- You can replace size_t with int or unsigned int
- while loop โ€“ First checks the condition, then executes the body
- for loop โ€“ firstly initializes, then, condition check, execute body, update.
- do-while Loop
- continue-break and infinte loops
- Nested Loops
- Major use of vectors (size() , vector.at() , size_t)
- Completed Section 9 (Control Programming Flow)
- Will Start With Section 10 (Characters and Strings)

Day 05

- Starting With Section 10 (Characters and Strings)
- Character Functions #include (cctype) library
- C-Style String #include(cstring)
- Working with C-style strings
- cin.getline(full_name,50) helps you to print full name including space upto 50 characters or any other limit you enter
- isalpha() function in C++ checks if the given character is an alphabet or not
- C++ strings #include(string)
- object.substr(start_index,length)
- object.find(search_string) , s1 += "Jomshi" - can used for concatinating
- getline(cin,s1) - read entire line until '\n' (DOESNT STOP AT SPACE)
- getline(cin,s1,"x") - here x is an delimiter after x nothing will be printed
- Uppercase character come before the Lowercase character in ASCII code
- s1.erase(index,length)
- s1.find(word) , if(position != string::npos)
- string::npos - npos is constant static value with highest possible value for an element of type size_t and it is defined with -1
- formatted_full_name.insert(index,expression);
- .swap() function in string
- Completed Section Challenge -https://github.com/Coollaitar/Journey-To-Learn-CPP/blob/main/Day%2005/day05.md

Day 06

- Starting With Functions Section
- #include (cmath) - cmath is library in which we can use maths function
- like - sqrt , cqrt , floor , ceil , round
- Pass the parameters from function if it returns something
- Function Prototype
- Program gets divided into two parts one is Header Information and Actual Implementation
- Parameters and Return Statement
- Remember the rules of PEMDAS when defining the body of your functions (P- Parentheses, E- Exponents, M- Multiplication, D- Division, A- Addition, and S- Subtraction)
- You can add default argument values to the function eg-double function(double pi = 3.14)
- If you are adding default arguements in a function then declare and define function before int main()
- It will not work if you define it after int main()
- Overloading Functions - Using same Name for various forms of that function
- Passing Arrays to C++ Function
- Pass by Reference
- Reference parameters (&parameter)
- Value doesnt changes even when parameter is passed into the function in main function
- Scope Rules
- Local Scope OR Block Scope
- Global Scope - Dont use Global Variables
- Local variables declared inside main function
- How do a function call work??
- Recursive Functions
- Section Challenge Not Completed Yet

Day 07

- Starting With Section 12 (Pointers and References)
- What is Pointer ? - It is the variable whose value is an address
- Unintialized Pointer Contains Garbage data and Points Anywhere
- Use nullptr
- All pointers have same size
- Dereferencing the pointer
- Dynamic Memory Allocation
- Allocating memory dynamically from the heap
- Create Storage Dynamically (int_ptr = new int) and (delete int_ptr) or (double_ptr = new double)
- Relationship between Arrays and Pointers
- Array of Pointer prints First element of array
- Comparing two pointer will compare address not values
- Pointer Arithmetic
- Constant In Pointer
- Passing Pointer To Function
- Returning a Pointer from a Function

Day 08

- Continuing with Pointers
-* How to create pointer array - int *p = new int [5];
- Delete the memory after using array (freeup the storage)- delete [] array_name
- Dangling Pointer - Pointer that is pointing to released memory
- dont forget to release allocated memory
- Use of references in pointer
- L values and R values
- L values - are the values that have names and are addressable
- R values - values which are not L values (right side) (cannot be modified and not addressable)
- Completed Section Challenge of Section 12 -https://github.com/Coollaitar/Journey-To-Learn-CPP/blob/main/Day%2008/day08.md
- Completed Section 12

Day 09

- Starting with Section 13 (OPP - Classes and Objects)
- Procedural Programming - Focus is on processes or actions that a program takes
- Classes are blueprints from which objects are created
- Delcaring a Class and creating Objects
- Class is terminated with ; (semicolon)
- We are creating a User Defined Data Type
- Use dot operator
- Use arrow operator (mostly for pointers)
- Derefrence the pointer - (*ptr).=
- Adding public to class is important
- Public and Private
- Public , Private , Protected
- Implementing Member Methods
- Creating .h files
- Constructors and Destructors
- Constructor
- Overloading Constructor
- Destructor - Useful to release memory and other resources
- Calling a destructor (~Player();)

Day 10

- Continuing with OPPS
- Default Constructor
- Constructor with arguements and no arguements
- Overloading Constructor - These are the constructors use for more number of arguements
- Constructor Intialization List
- Delegating Constructor
- Constructor Parameters and Default Values

Day 11

- Continuing with OOPS
- Constructor Parameter and Default Values - No addition of No arguement constructor and One arguement constructor
- Directly initializing constructor under public:
- Player empty; will not work (Ambigous)
- Copy Constructor

Day 12

- Copy of constructor is used to intialize the members of newly created object by copying the members of an already existing object
- Copy of constructor has to be intialize in public:
- Shallow Copying with the Copy constructor
- Shallow Copy - Work With Heap Memory Allocation but if some variables are dynamically allocated memory from heap section then the copied object will also reference the same memory location
- Changes are made in copy constructor to define Shallow and Deep Constructor
- For Shallow(we use copy constructor as) - *data = source.data
- For Deep(we use copy constructor as) - *data = *source.data
- Deep - Copy Heap Storage (Not copying pointer we are copying data to the pointer)
- Shallow And Deep Copy Are One Of The Most Important Topic According To Me
- Move Constructors
- Can be used for efficiency
- Single & refers to L value and Double && refers to R value
- Move Constructor moves the resources in the heap
- Intialization in public: of Move Constructor : Move(Move &&source)noexcept;
- source.data = nullptr;: Important step or it will end up doing shallow copy
- The this Pointer
- Using const with Classes - std::string get_name() const{return name}
- Static Class Members
- Struct V/s Classes (Just Use Classes)
- Objects are by default public in Structs and private in Classes
- Friends of a Class - A Function or a Class that has access to the private class members (Will be used in next section in Operator Overloading)
- Section Challenge 13 remaining

Day 13

- Will Do Section Challenge in some time
- Starting With Section Operator Overloading
- What is Operator Overloading ? - Using Traditional Operators
- Makes Code Easily Readable and Understandable
- Assignment operator must be declared as the member methods

Day 14

- Continuing with section Section 14
- We store Declaration of class in Mystring.h file and Initialization in Mystring.cpp file and calling in main.cpp
- Overloading the Assignment Operator (copy)
- Copy Assignment Operator (=)

Day 15

- Operator Overloading Provides us Flexibility
- Overloading Assignment Operator (deep copy) is intialized - Mystring &Mystring :: operator = (const Mystring &rhs);
- Steps for deep copy - 1) Allocate storage for deep copy : str = new char [std::strlen(rhs.str) + 1]
- We need extra space for terminator
- Perform the copy : std::strcpy(str,rhs.str);
- Return the current by reference to allow chain assignment : return *this;
-

journey-to-learn-cpp's People

Contributors

coollaitar avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.