
C++
文章平均质量分 69
???/cy
算法工程师,日常分享多模态领域的前沿成果,与自己工程经验的总结,问道~大模型
展开
-
C++传输图片给服务端
【代码】C++传输图片给服务端。原创 2023-03-13 18:57:17 · 649 阅读 · 2 评论 -
C++|Passing arguments by reference
目的:While pass by value is suitable in many cases, it has a couple of limitations. First, when passing a large struct or class to a function, pass by value will make a copy of the argument into the function parameter. In many cases, this is a needless per原创 2021-07-06 15:42:18 · 501 阅读 · 0 评论 -
C++|Const
Classesare an expanded concept ofdata structures: like data structures, they can contain data members, but they can also contain functions as members.class class_name { access_specifier_1: member1; access_specifier_2: member2; ...} ob...原创 2021-07-06 13:51:38 · 98 阅读 · 0 评论 -
C++|Other data types
Type aliases (typedef / using)In C++, any valid type can be aliased so that it can be referred to with a different identifier.//using new_type_name = existing_type ;using C = char;using WORD = unsigned int;using pChar = char *;using field = char.原创 2021-06-28 15:47:48 · 228 阅读 · 0 评论 -
C++|Data structures
Data structuresAdata structureis a group of data elements grouped together under one name. These data elements, known asmembers, can have different types and different lengths. Data structures can be declared in C++ using the following syntax:struc...原创 2021-06-25 20:09:28 · 137 阅读 · 0 评论 -
C++|Dynamic memory
In the programs seen in previous chapters, all memory needs were determined before program execution by defining the variables needed. But there may be cases where the memory needs of a program can only be determined during runtime. For example, when the m原创 2021-06-25 17:36:34 · 183 阅读 · 0 评论 -
C++|Pointer
Address-of operator (&)The address of a variable can be obtained by preceding the name of a variable with an ampersand sign (&), known asaddress-of operator. For example:int *foo;foo = &myvar; //foo 必须是个指针,才能存&This would assign t..原创 2021-06-25 16:35:44 · 160 阅读 · 0 评论 -
C++|Pointer arithmetics
*p++ // same as *(p++): increment pointer, and dereference unincremented address*++p // same as *(++p): increment pointer, and dereference incremented address++*p // same as ++(*p): dereference pointer, and increment the value it points to(*p)++ .原创 2021-06-25 11:26:57 · 180 阅读 · 0 评论 -
C++|Array
A typical declaration for an array in C++ is:type name [elements];wheretypeis a valid type (such asint,float...),nameis a valid identifier and theelementsfield (which is always enclosed in square brackets[]), specifies the length of the array i...原创 2021-06-24 11:27:43 · 194 阅读 · 0 评论 -
C++|Namespaces,Storage classes
Namespaces allow us to group named entities that otherwise would haveglobal scopeinto narrower scopes, giving themnamespace scope. This allows organizing the elements of programs into different logical scopes referred to by names.namespace identifier...原创 2021-06-24 10:10:04 · 101 阅读 · 0 评论 -
C++|Templates
Defining a function template follows the same syntax as a regular function, except that it is preceded by thetemplatekeyword and a series of template parameters enclosed in angle-brackets <>:template <template-parameters> function-declarati..原创 2021-06-24 09:32:21 · 104 阅读 · 0 评论 -
C++|inline function,Declaring functions,Recursivity
inline functionCalling a function generally causes a certain overhead (stacking arguments, jumps, etc...), and thus for very short functions, it may be more efficient to simply insert the code of the function where it is called, instead of performing the原创 2021-06-23 16:17:13 · 147 阅读 · 0 评论 -
C++|Efficiency considerations and const references
string concatenate (string a, string b){ return a+b;}This function takes two strings as parameters (by value), and returns the result of concatenating them. By passing the arguments by value, the function forcesaandbto be copies of the arguments...原创 2021-06-23 15:36:16 · 122 阅读 · 0 评论 -
C++|Functions with no type. The use of void
The syntax shown above for functions:type name ( argument1, argument2 ...) { statements }Requires the declaration to begin with a type. This is the type of the value returned by the function. But what if the function does not need to return a value? In th原创 2021-06-23 15:10:31 · 145 阅读 · 0 评论 -
C++|Arguments passed by value and by reference
// passing parameters by reference#include <iostream>using namespace std;void duplicate (int& a, int& b, int& c){ a*=2; b*=2; c*=2;}int main (){ int x=1, y=3, z=7; duplicate (x, y, z); cout << "x=" << x &.原创 2021-06-23 15:04:48 · 133 阅读 · 0 评论 -
C++|stringstream
The standard header<sstream>defines a type calledstringstreamthat allows a string to be treated as a stream, and thus allowing extraction or insertion operations from/to strings in the same way as they are performed oncinandcout. This feature ...原创 2021-06-23 15:02:02 · 112 阅读 · 0 评论 -
C++|using, string, vector
1,命名空间的using声明作用域操作符(::)编译器应从操作符左侧名字所示的作用域中寻找右侧那个名字。std::cin的意思就是要使用mingmingko原创 2021-06-23 14:26:05 · 225 阅读 · 0 评论 -
C++|算数类型;引用;指针;
1.可寻址的最小内存块称为“字节(byte)”2. 存储的基本单元称为“字(word)”原创 2021-06-16 13:25:26 · 161 阅读 · 0 评论 -
C++|读取多个ISBN的销售记录,输出所有记录的和
#include<iostream>#include "Sales_item.h"int main(){ Sales_item total, book; std::cout << "请输入几个ISBN相同的书籍" << std::endl; if (std::cin >> total) { while (std::cin >> book) { if (compareIsbn(total, book)) { tot.原创 2021-06-04 11:25:47 · 426 阅读 · 0 评论