{"id":27307489,"url":"https://github.com/zakhaev26/cpp","last_synced_at":"2025-10-06T12:52:47.210Z","repository":{"id":102149941,"uuid":"594634145","full_name":"zakhaev26/Cpp","owner":"zakhaev26","description":"Git Repo for my C++ Codes and Notes for future reference.","archived":false,"fork":false,"pushed_at":"2023-04-03T16:37:09.000Z","size":230,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-17T11:47:37.045Z","etag":null,"topics":["cpp"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zakhaev26.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-01-29T06:30:02.000Z","updated_at":"2023-02-04T18:23:34.000Z","dependencies_parsed_at":"2023-09-11T05:23:09.450Z","dependency_job_id":"70d072c2-ad60-4774-9481-8819daac135f","html_url":"https://github.com/zakhaev26/Cpp","commit_stats":null,"previous_names":["zakhaev26/cpp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zakhaev26/Cpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zakhaev26%2FCpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zakhaev26%2FCpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zakhaev26%2FCpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zakhaev26%2FCpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zakhaev26","download_url":"https://codeload.github.com/zakhaev26/Cpp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zakhaev26%2FCpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278614461,"owners_count":26015967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp"],"created_at":"2025-04-12T04:10:04.304Z","updated_at":"2025-10-06T12:52:47.153Z","avatar_url":"https://github.com/zakhaev26.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# C++ Udemy Course by Frank M.{Notes include only important points which i might forget!}\n\n--------------------------------------------\n\n- Using namespace directives helps us ease out the tedious job to write std:: again and again.\nnote: the ```::``` operator is known as scope resolution Operator and is used with std ,or the Standard namespace library.\nThird party librarie may have their own way of declaring variables which we might use so in order to prevent that we use namespace.\n\n```\n#include\u003ciostream\u003e\n\nusing namespace\n\n```\n\n```\n#include\u003ciostream\u003e\n\nusing namespace std;\n\nint main(){\n\n    cout\u003c\u003c\"Hello World!;\n    cin\u003e\u003e......\n    count\u003c\u003c....\u003c\u003cendl;\n    return 0;\n}\n//reduces the work of writing std.\n```\n\nNotice that I no longer have to use std followed by the scope resolution operator when I refer to cin, cout and endline.The compiler now knows which one to use based on the using namespace directive.\n\n\nC++ uses a stream abstraction to handle IO on devices like the console and keyboard.\nCout is an output stream that defaults to the console or the screen.\nCerr and clog are also output streams that default to standard error and standard log, respectively.\nAnd finally, cin is an input stream that defaults to the keyboard.\nThe insertion operator(\u003c\u003c) is used with output streams,and the extraction operator is used with input streams.\n\ncout is by default the console,the value of data will be displayed on the screen.\n\nSince we're using stream abstraction,we can chain multiple insertions in the same statement.This makes basic IO very, very easy to do.\n\nIt's important to understand that the insertion operator does not automatically add linebreaks to move to the next line on the console.\nYou must do this explicitly either by using the end line manipulator\n(std::endl OR endl;) or by including a new line character, the /n .\n\nIf you use the end line stream manipulator, it will also flush the stream,this is important to know since if the stream is buffered,\nit may not get written to the console until it's flushed.More about it at the later stages.\n\n\n - Let's see how the extraction operator works with cin.\n\nThe extraction operator extracts information from the cin input stream which defaults to the keyboard and stores the information into the variable to the right of the extraction operator.The way in which the information is interpreted is based on the type of the variable.So in this case, if data is an integer then an integer representation\nwill be read from the keyboard.\nIf data is a double then a real number will be read and stored.\n\nIf data is a string a sequence of characters will be read and stored.\n\nExtraction operators can also be chained. In the second example,\n```\ncin\u003e\u003edata_\u003e\u003edata_2;\n```\nTwo variables data1 and data2 will be assigned values read from the keyboardbased on their type.\nThe characters entered using the keyboard will only be processed when the enter key is pressed.\nCin extraction uses white space that is spaces, tabs, new lines as terminating the value being extracted.That's important to understand. So if you put spaces between the things that you type in,the spaces will be ignored.\n\nIt's possible that the extraction operator could fail:\n\nFor example, suppose you want to read an integer and the user enters my name Soubhik.In this case, the operation fails and the data will have an undetermined value.(Garbage)\n\n\n-imp note:\n```\n    int a;\n    float b;\n\n    cout\u003c\u003c\"Enter a integer:\\n\";\n    cin\u003e\u003ea;\n    cout\u003c\u003c\"Enter a floating number:\\n\";\n    cin\u003e\u003eb;\n    cout\u003c\u003c\"Your a = \\n\"\u003c\u003ca\u003c\u003c\"Your b= \"\u003c\u003cb;\n\n```\n\nhere,if you put a floating number in int variable,the program would show that a = [num] and b ={num}\n\ni.e. it floors and ceils AUTOMATICALLY! \n\n\n#Declaring variables in cpp;\n\n```\nint age;//uninitialized\nint age  =21; //C Like initialization\nint age (21); //Constructor initialization\nint age {21}; //C++11 list initialization syntax\n\n```\nNOTE:It is recommended to use the last type of initialization in programs of cpp.\n\n\n-Global scoped Variables:\n\nThese are variable which are declared globally ,i.e outside of the main function so that it can be accessed in it when INTERNALLY the ame variable is initialized inside the main function.\n\n```\n#include\u003ciostream\u003e\n\nint age =16;\nint main()\n{\n\n    // int age =18;\n    std::cout\u003c\u003c\"the age is =\"\u003c\u003cage;\n\n\n\n\n    return 0;\n}\n```\n\n\nhere,if you remove the main declared var, then the comopiler will take the global variable in order to output age.\n\n\nThe c++ ```include file climits``` contains information about the size and precision of the data types for your specific compiler.\n\n\n```\nconst int age{21};//constant in cpp\n\nage++\ncout\u003c\u003cage;//throws error..\n\n\n```\n\n\n\n```\nLiteral Constants:--\u003e\n\n\\n ==newline \n\\t ==tabline\n\\r == return \n\\b ==backspace\n\\' ==single quote\n\\\" ==double quote\n\\\\ == backslash\n\n\n\n```\n\n\n# Arrays and Vectors:\n\nArray is a compound data structure which is a collection of elements present in a contiguous memory location.\nnote that the elemetns are of same type and and each elements can be accessed directly.\n- Very efficient.\n\n```\nint test_scores [5];\n\ndouble marks [20];\n\nconst int xyz [34];\n\n```\n\n- initialization:\n\n```\nint test_scores [5] {1,4,5,6,9};\n\ndouble marks [20] {0} ;//init all to zero\n\nconst int xyz [] {3,4,6,6};//auto fixes the size by itself ,just like C\n\n\n```\n\nNote: in c++ \u003e14 vers, array init is a bit different and rules et are varied.although you can check up on online websites for any learning purposes while working over different versions of cpp as the version i am using to learn cpp is c++ 6.3.0...\n\n# Multi Dimensional Arrays:\n\n\nin cpp,you can create nulti dimensional arrays which are like ,you can say, a matrix of a 1D dimension.\n\ndeclaration method:\n\n```\nint arr[2][3] {{}};\nstring arr[3][7] \n\n```\nan example is inroduced in code repository.\n\n\nVector:\n\n- must include ```#include\u003cvector\u003e``` file \n- must plug in ```using namespace std; ``` as vector is a standard libary.\n\n## Initialization type 1:\n\n```vector \u003cchar\u003e vowels(10);```// automatically sets up a vector named vowels of size 10 and and initializes to automatically to 0.\n\n```vector \u003cint\u003e  test_scores(10);```//automatically sets up a vector named vowels of size 10 and and initializes to automatically to 0.\n\n## Initialization type 2:\n\n```vector\u003cchar\u003e vowels {'a','e','i','o','u'};```\n\n```vector\u003cint\u003e test_scores {100,89,98,45,};```\n\n```vector\u003cdouble\u003e hi_temp (365,80.0);```//makes a vector of type double and name hi_temp of size 365 and initializes all 365 values to 80.0;\n\n## Advantages of Using Vectors:\n\n- Dynamic Sizes\n- Elements are all the same type\n- Stored in contiguously memory locations.\n- [  ] -no checking to see if you are out of bounds\n- provides many useful functions to operate on vectors.\n\n\n-Elements are already initialized to Zero.(doesnt work like this on arrays.)\n-Very Efficient.\n-Iteration (looping) is often used to process.\n\n### What if you're out of bounds:\n\n- Arrays never do bounds checking.\n- Many vector methods do boundary checking.\n- An exception and error message is encountered\n``` \nvector\u003cint\u003e number {12,34,56,67,78,89};\nnumber.size();\n//returns size of the vector number;\n```\n\n### Examples of  2d Vectors:\n\n```\nvector \u003cvector\u003cint\u003e\u003e movie_ratings\n{\n    {1,2,3,4},\n    {5,6,7,8},\n    {9,10,11,12},\n    {13,14,15,16}\n};\n\n\n//accesing:\n\ncout\u003c\u003c\"My(Judge no.1) Movie Ratings for #1 is:\"\u003c\u003cmovie_ratings.at(0).at(0);\ncout\u003c\u003c\"My(Judge no.2) Movie Ratings for #4 is:\"\u003c\u003cmovie_ratings.at(1).at(3);\n\n```\n\n\n\n# Difference between pre-increment and post increment operators!\n\n## (same logic with pre-dec and post-dec ops):\n\n\n```\nint number {10};\n\nnumber++;\ncout\u003c\u003cnumber\u003c\u003cendl;//returns 11\n\n++number;\ncout\u003c\u003cnumber\u003c\u003cendl;//returns 12\n\n\n//here,both the operators seem to work like they're same.\n```\n\n\n```\nint number {10};\n\nint result;\n\nresult =number++;\ncout\u003c\u003cresult\u003c\u003cendl;//prints 10\n\n//value of number changed to 11 in ram...\n\nresult =++number;\ncout\u003c\u003cresult\u003c\u003cendl; //prints 12;\n//value of number is FIRST INCREMENT then ASSIGNED to result.\n\n//here,you can see the difference!\n```\ngitcom\n\n# COERSION:--\u003e\nC++ is very consistent with its application of an operator to operands.\n\n\nThe operands must be of the same type.\n\n## It's very important to understand the rules that c++ uses to ensure that the types are the same since the results of the calculation could be different depending on which operand type is changed.\n- C++ will try to convert one of the operands so it matches the other.In many cases, this happens automatically, and we'll talk about how that works in the next slide.If an automatic conversion or coercion is not possible,\nthen a compiler error will occur.\n- We saw an example of this in the assignment operator video when we tried to assign a string to an integer.\n- In order to understand how these conversions happen,we need to understand higher versus lower types.\n- The idea is simple.The lower types are those types that can hold smaller values and the higher types can hold larger values. \n- So a long double is of higher type than a long and a long is of higher type than an int.\n- The idea is that we can typically convert from a lower type to a larger type automatically since the lower types value will fit into the higher types value but the opposite may not be true.\n- Short and character types are always converted to integers.So let's learn the terminology.A type conversion is also called a coercion\n\n\n## example:\n\n```\nint total_amount {100};\nint total_number {8};\ndouble average {0.0};\n\naverage =total_amount/total_number;//returns 12 and NOT 12.5.\n\n//Reason:the total_number and total_amount ,both are of integer type,so the compiler will perform integer division and store the value of 12 in average.the 0.5 is hence TRUNCATED...\n\n//PERFORMING COERSION:\n\naverage =static_cast\u003cdouble\u003e(total_amount)/(total_number);//displays 12.5 now....\n\n```\n\n## syntax: ```static_cast\u003cdata type\u003e```\n\n\ntip:\n\nanother way of taking multiple inputs from user in cpp is:\n\n```\nint a{},b{},c{};\ncout\u003c\u003c\"Enter three numbers separated side by side with spaces in between\"\u003c\u003cendl;\ncin\u003e\u003ea\u003e\u003eb\u003e\u003ec;\n```\nthis works this way as well :p\n\n\n### bool related tip:\nSometimes it's handy to display the words true and false rather than 1 and 0 in the output statements.\n\nWe can do that using the ```boolalpha stream manipulator```.```Boolalpha ```and ```noboolalpha``` are located in the standard namespace.Once you use them, all Boolean output to the stream will result in the words true and false being displayed, that can be pretty handy.\n\nIf you want to go back to the default of zero and one, just use no bool alpha.\n\neg:---\u003e\n\n```\nbool result{false};\n\nresult = (100==50+50);//true or 1\nresult = (200!=200);//false or 0\n\ncout\u003c\u003cresult//returns 0 or 1 depending on the statements..\ncout\u003c\u003cstd::boolalpha \n```\n\nNOTE: if we are storing 12.0 and 11.99999999999999999999999 as doubles and check for their equality, the computer will store them as approximated numbers and to it these two number are same..hence to build high level precision programs or to create code for which 12.0 != 11.99999999999,we use some specific libraries made for it,which we will learn afterwards.\n\n\n## logical operators:\n\nyou can use logical ops as syntax is given below:\n\n- AND: ```and``` , ```\u0026\u0026``` this is a binary operator\n- OR: ```or``` ,```||```this is a binary operator\n- NOT:```not ```,```!```this is a unary operator\n\n- precedence(priority): not \u003e and \u003e or \n\n## Compound operators example: lhs += rhs, lhs *=rhs ,lhs\u003c\u003c=rhs,lhs|=rhs,etc\n\n\n# Control Flow Program\n- sequence\n- decision making\n- iteration\n\n# Selection Decision Making--\u003e\n\n- if-else\n- if\n- Nested if statements\n- switch statements\n- ?  : ternary operator if else statements(in a short hand version)\n\n\n\n# Looping\n\n- for loops\n- while loops\n- do-while loops\n- continue and breaks\n- Nested loops\n- infinite loops\n\n\nAn enumeration is a user-defined data type that consists of integral constants. To define an enumeration, keyword enum is used.\n\n```\n#include \u003ciostream\u003e\nusing namespace std;\n\nenum week { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday };\n\nint main()\n{\n    week today;\n    today = Wednesday;\n    cout \u003c\u003c \"Day \" \u003c\u003c today+1;\n    return 0;\n}```\n\nthis above code returns Thursday.\n\n\n\n# Range based for loops:\n```#include \u003ciostream\u003e\n#include \u003cvector\u003e\nusing namespace std;\n\nint main(void)\n{\n\n    int scores[]{12, 23, 34, 45, 89};\n    // the \"mark\" variable sets itself onto the base address of the array and then it just goes on until the array exhausts.In this way the loop looks easy and less prone to error.\n    for (int mark : scores)\n    {\n        cout \u003c\u003c mark \u003c\u003c endl;\n    }\n\n    cout \u003c\u003c endl;\n    // also works in vectors!\n    vector\u003cint\u003e numbers{1, 23, 45, 6, 70};\n\n    for (int numero : numbers)\n    {\n        cout \u003c\u003c numero \u003c\u003c endl;\n    }\n\n    return 0;\n}\n```\nNOTE:We can also use the ```auto``` keyword instead of int or double while setting up the RBFL.\n\nRounding up library:\n\n```#include\u003ciomanip\u003e\n.\n.\n.\n.\ncout\u003c\u003cfixed\u003c\u003csetprecision(1)\n```\n\ngets you rounded up form of number upto 1 place.\n\n\neg:\n\nfor(auto c:{This is a string}){\n    cout\u003c\u003cc;\n}\n\n# Characters:\n\n These are the functions that we can use with characters.\nThis cctype library includes very simple and very useful function that allow the testing of characters for various properties as well as the conversion of characters from upper to lower or lower to uppercase.\n```#include\u003ccctype\u003e```\nIn order to use these functions, you must include cctype.The functions all expect a single character.In the case of the testing functions, they evaluate to true or false.And the conversion functions return the converted character.\n\n# Strings:\n\n- C-style strings are stored in contiguous in memory\n- implemented as an array of characters.\n- terminated by a null character(null{null character with a value of zero})\n- Zero or nul terminated strings.\n\n## string literal:\n- sequence of characters in double quotes,e.g:\"Frank\".\n```F r a n k \\0```\n- constant\n- terminated with null characters.\n\n\n```\nchar array [10] {};\n\narray =\"Soubhik\"\n``` \nthrows an error.\nas the compiler searches for a null character in the string and as you have already initialized it to zero by giving the {} thing,even if you try to insert a string externally,it will fail.\ninstead of this,you can use rhe strcpy fxn from cstrings library.\nsome of the common  functions present in cstrings library are:\n1)strlen(string_Name)\n2)strcpy(where,string New)\n3)strcmp(string1,string 2)\n4)strcat(string_1 ,+string _2)\n\nnote:cstdlib is a library which allows us to convert a string to different data_types (if possible):\n\n```cin.getline(full_name,50) ``` is similar to ```fgets``` in Clang.\n\n```include \u003ciostream\u003e\n\n#include\u003cstring.h\u003e\n\nusing namespace std;\n\nint main(){\n\n    string user_name; // declaring variable\n\n    // taking user input with cin\n\n    std::cout \u003c\u003c \"What is your name? :\" \u003c\u003c std::endl; \n\n    // using getline\n\n    getline(cin, user_name);\n\n    cout\u003c\u003c\"\\nWelcome to Simplilearn \"\u003c\u003cuser_name;\n\n    return 0;\n\n}\n```\n\nOutput:\n\n\n\n\n# C++ style strings--\u003e\n\n- In order to use c++ plus strings, you must include the string header file.\n\n- Strings are in the standard namespace.So in order to use them without using namespace standard, you must prefix them with standard and the scope resolution operator.This is also true for the standard string methods that work with c++ strings.\n\n- Like c-style strings, c++ strings are stored contiguously in memory.However, unlike c-style strings which are fixed in size, c++ strings are dynamic and can grow and shrink as needed at runtime.\n\n- C++ strings work with the stream insertion and extraction operators just like most other types in c++.\n\n- The c++ string class provides a rich set of methods or functions that allow us to manipulate strings easily.Chances are that if you need to do something with the string that functionality is already there for you without having to rewrite it from scratch.\n\n- C++ strings also work with most of the operators that we're used to for assigning, comparing and so forth.This is a huge advantage over c-style strings since c-style strings don't work well with those operators.\n\n- Even though c++ strings are preferred in most cases sometimes you need to use c-style strings.\nMaybe you're interfacing with a library that's been optimized for c-style strings. Well, in this use case, you can still use c++ strings and take advantage of them.And when you need to you can easily convert the c++ string into a c-style string and back again.\n\n- Like vectors, c++ strings are safer since they provide methods that can perform bounds check and allow you to find errors in your code so you can fix them before your program goes into production.\n\n\n```\n#include\u003cstring\u003e\n.\n.\n.\nstring s1 {\"hello\"};\nstring s2 =s1;\nstring s2 ={\"Morbius\"};\ns1==s2 \n\n```\n```\nstring s1 {\"Hello\"};\nstring s2 {\"world\"};\n\ncout\u003c\u003c s1+\" \" +s2; //Hello World\n\n//but...\n\ncout\u003c\u003c \"Hello\"+ \" World\"; //throws error as it is a c style string and this type of string cant perform c++ type operations.\n\n```\n\n\nnote: std::npos means the word that you're trying to retreive isnt present in the object string.\n\n\n# All string functions:\n\n- getline()\tThis function is used to store a stream of characters as entered by the user in the object memory.\n- push_back()\tThis function is used to input a character at the end of the string.\n- pop_back()\tIntroduced from C++11(for strings), this function is used to delete the last character from the string.\n\n```\n/ C++ Program to demonstrate the working of\n// getline(), push_back() and pop_back()\n#include \u003ciostream\u003e\n#include \u003cstring\u003e // for string class\nusing namespace std;\n \n// Driver Code\nint main()\n{\n    // Declaring string\n    string str;\n \n    // Taking string input using getline()\n    getline(cin, str);\n \n    // Displaying string\n    cout \u003c\u003c \"The initial string is : \";\n    cout \u003c\u003c str \u003c\u003c endl;\n \n    // Inserting a character\n    str.push_back('s');\n \n    // Displaying string\n    cout \u003c\u003c \"The string after push_back operation is : \";\n    cout \u003c\u003c str \u003c\u003c endl;\n \n    // Deleting a character\n    str.pop_back();\n \n    // Displaying string\n    cout \u003c\u003c \"The string after pop_back operation is : \";\n    cout \u003c\u003c str \u003c\u003c endl;\n \n    return 0;\n}\n```\n- capacity():\tThis function returns the capacity allocated to the string, which can be equal to or more than the size of the string. Additional space is allocated so that when the new characters are added to the string, the operations can be done efficiently.\n\n- resize():\tThis function changes the size of the string, the size can be increased or decreased.\n\n- length(): This function finds the length of the string.\n\n- shrink_to_fit():\tThis function decreases the capacity of the string and makes it equal to the minimum capacity of the string. This operation is useful to save additional memory if we are sure that no further addition of characters has to be made.\n\n```\n// C++ Program to demonstrate the working of\n// capacity(), resize() and shrink_to_fit()\n#include \u003ciostream\u003e\n#include \u003cstring\u003e // for string class\nusing namespace std;\n \n// Driver Code\nint main()\n{\n    // Initializing string\n    string str = \"geeksforgeeks is for geeks\";\n \n    // Displaying string\n    cout \u003c\u003c \"The initial string is : \";\n    cout \u003c\u003c str \u003c\u003c endl;\n \n    // Resizing string using resize()\n    str.resize(13);\n \n    // Displaying string\n    cout \u003c\u003c \"The string after resize operation is : \";\n    cout \u003c\u003c str \u003c\u003c endl;\n \n    // Displaying capacity of string\n    cout \u003c\u003c \"The capacity of string is : \";\n    cout \u003c\u003c str.capacity() \u003c\u003c endl;\n \n    // Displaying length of the string\n    cout \u003c\u003c \"The length of the string is :\" \u003c\u003c str.length()\n         \u003c\u003c endl;\n \n    // Decreasing the capacity of string\n    // using shrink_to_fit()\n    str.shrink_to_fit();\n \n    // Displaying string\n    cout \u003c\u003c \"The new capacity after shrinking is : \";\n    cout \u003c\u003c str.capacity() \u003c\u003c endl;\n \n    return 0;\n}\n\nOUTPUT \u003e\u003e\u003e\n\nThe initial string is : geeksforgeeks is for geeks\nThe string after resize operation is : geeksforgeeks\nThe capacity of string is : 26\nThe length of the string is :13\nThe new capacity after shrinking is : 13\n\n```\n## ITERATOR FUNCTIONS:\n\n- begin()\tThis function returns an iterator to the beginning of the string.\n- end()\tThis function returns an iterator to the next to the end of the string.\n- rbegin()\tThis function returns a reverse iterator pointing at the end of the string.\n- rend()\tThis function returns a reverse iterator pointing to the previous of beginning of the string.\n- cbegin()\tThis function returns a constant iterator pointing to the beginning of the string, it cannot be used to modify the contents it points-to.\n- cend()\tThis function returns a constant iterator pointing to the next of end of the string, it cannot be used to modify the contents it points-to.\n- crbegin()\tThis function returns a constant reverse iterator pointing to the end of the string, it cannot be used to modify the contents it points-to.\n- crend()\tThis function returns a constant reverse iterator pointing to the previous of beginning of the string, it cannot be used to modify the contents it points-to.\n\neg in gfg..\n\n## Manipulation functions :\n\n- copy(“char array”, len, pos) \tThis function copies the substring in the target character array mentioned in its arguments. It takes 3 arguments, target char array, length to be copied, and starting position in the string to start copying.\n- swap()\tThis function swaps one string with another\n\nNOTE:In order to use C style strings ,one needs to include ```#include\u003ccstrings\u003e``` file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzakhaev26%2Fcpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzakhaev26%2Fcpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzakhaev26%2Fcpp/lists"}