随笔分类 -  C++

摘要:Lists are sequence containers that allow non-contiguous memory allocation. As compared to vector, the list has slow traversal, but once a position has 阅读全文
posted @ 2023-02-21 10:39 shendawei 阅读(54) 评论(0) 推荐(0)
摘要:Pair is used to combine together two values that may be of different data types. The pair container is a simple container defined in header consisting 阅读全文
posted @ 2023-02-21 10:24 shendawei 阅读(105) 评论(0) 推荐(0)
摘要:5 ways to create an Array of String Using Pointers Using 2-D Array Using the String Class Using the Array Class Using the Vector Class Conclusion: Out 阅读全文
posted @ 2023-02-09 11:24 shendawei 阅读(42) 评论(0) 推荐(0)
摘要:They both are resulting in same address but they are different types of addresses. Basically, “array” is a “pointer to the first element of array” but 阅读全文
posted @ 2023-02-02 10:19 shendawei 阅读(34) 评论(0) 推荐(0)
摘要:argc (ARGument Count) is int and stores number of command-line arguments passed by the user including the name of the program. So if we pass a value t 阅读全文
posted @ 2023-02-02 09:23 shendawei 阅读(31) 评论(0) 推荐(0)
摘要:1. Constructor Default constructors Parameterized constructors Copy constructors // C++ program to demonstrate constructors #include <bits/stdc++.h> u 阅读全文
posted @ 2023-01-10 19:23 shendawei 阅读(44) 评论(0) 推荐(0)
摘要:Note In C, all function arguments are passed by value. (including arrays: This means that when an array is passed as an argument to a function, a copy 阅读全文
posted @ 2023-01-06 14:37 shendawei 阅读(74) 评论(0) 推荐(0)
摘要:https://www.geeksforgeeks.org/scope-of-variables-in-c/ 阅读全文
posted @ 2022-12-23 10:57 shendawei 阅读(20) 评论(0) 推荐(0)
摘要:1. do not need exception message try { // } catch (...) { // } 2. need exception message try { // } catch (const std::exception& e) // reference to th 阅读全文
posted @ 2022-12-22 18:18 shendawei 阅读(35) 评论(0) 推荐(0)
摘要:1. initial // https://en.cppreference.com/w/c/language/array_initialization 2. get max or min element // array int a[6] = { 1, 45, 54, 71, 76, 12 }; a 阅读全文
posted @ 2022-12-22 14:39 shendawei 阅读(88) 评论(0) 推荐(0)
摘要:/*************** In for Loop ***************/ // You'd better always use ++i. // Since the logic is the same while i++ needs to save old value before 阅读全文
posted @ 2022-12-20 10:08 shendawei 阅读(25) 评论(0) 推荐(0)
摘要:Vectors are same as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted, with their storage being ha 阅读全文
posted @ 2022-12-06 09:40 shendawei 阅读(47) 评论(0) 推荐(0)
摘要:1. Common sort Example from cplusplus.com: // sort algorithm example #include <iostream> // std::cout #include <algorithm> // std::sort #include <vect 阅读全文
posted @ 2022-12-05 15:42 shendawei 阅读(117) 评论(0) 推荐(0)