C++ Primer (第五版)第三章习题部分答案

       在我自学C++过程中,我选择了C++Primer这本书,并对部分代码习题进行了求解以及运行结果。接下来几个月我将为大家定时按章节更新习题答案与运行结果,运行环境(Visual Studio Code,windows 11):

3.1.1.使用恰当的using 声明重做 1.4.1节和2.6.2节的练习。

1.4.1 

#include <iostream>using std::cin;
using std::cout;
using std::endl;int main()
{int sum = 0;for (int val = 1; val <= 10; ++val) sum += val;cout << "Sum of 1 to 10 inclusive is " << sum << endl;return 0;
}

 2.6.2

#include <iostream>
#include <string>
using std :: cin;
using std :: cout;
using std :: endl;
using std :: string;
struct Sale_data
{string bookNo;unsigned units_sold = 0;double revenue = 0.0;
};
int main()
{Sale_data total;double totalprice;if(cin >> total.bookNo >> total.units_sold >> totalprice){total.revenue = total.units_sold*totalprice;Sale_data nextdata;double nextprice;while(cin >> nextdata.bookNo >> nextdata.units_sold >> nextprice){nextdata.revenue = nextprice*nextdata.units_sold;if(total.bookNo == nextdata.bookNo){total.units_sold += nextdata.units_sold;total.revenue += nextdata.revenue;}else{cout << total.bookNo << ":" << total.units_sold << " " << total.revenue << " ";if(total.units_sold != 0)  cout << total.revenue/total.units_sold << endl;else  cout << "No Sales!" << endl;total.bookNo = nextdata.bookNo;total.units_sold =nextdata.units_sold;total.revenue = nextdata.revenue;}}cout << total.bookNo << ":" << total.units_sold << " " << total.revenue << " ";if(total.units_sold != 0)  cout << total.revenue/total.units_sold << endl;else  cout << "No Sales!" << endl;}else cout << "No data!" << endl;return 0;
}

3.2.编写一段程序从标准输入中一次读入一行,然后修改该程序使其一次读入一个词。

One Row

#include <iostream>
#include <string>
using std :: cin;
using std :: cout;
using std :: endl;
using std :: string;
using std :: getline;
int main()
{string l;while(getline(cin,l)){cout << l << endl;}return 0;
}

One Word!

#include <iostream>
#include <string>
using std :: cin;
using std :: cout;
using std :: endl;
using std :: string;
int main()
{string w;while(cin >> w){cout << w << endl;}return 0;
}

3.4.编写一段程序读取两个字符串,比较其是否相等并输出结果。如果不相等,输出比较大的那个字符串。改写上述程序,比较输入的两个字符串是否等长,如果不等长,输出长度较大的那个字符串。

3.4.1

#include <iostream>
#include <string>
using std :: cin;
using std :: cout;
using std :: endl;
using std :: string;
int main()
{string w1, w2;cin >> w1;cin >> w2;if(w1 == w2)cout << "相等!" << endl;else if(w1 > w2)cout << w1 << endl;elsecout << w2 << endl;return 0;
}

3.4.2

#include <iostream>
#include <string>
using std :: cin;
using std :: cout;
using std :: endl;
using std :: string;
int main()
{string w1, w2;cin >> w1;cin >> w2;if(w1.length() == w2.length())cout << "相等!" << endl;else if(w1.length() > w2.length())cout << w1 << endl;elsecout << w2 << endl;return 0;
}

3.5.编写一段程序从标准输入中读入多个字符串并将他们连接起来,输出连接成的大字符串。然后修改上述程序,用空格把输入的多个字符串分割开来。

3.5.1.字符串拼接

#include <iostream>
#include <string>
using std :: cin;
using std :: cout;
using std :: endl;
using std :: string;
int main()
{string w1, w2, w;cin >> w1;cin >> w2;w = w1 + w2;cout << w << endl;return 0;
}

3.5.2.空格拼接。

#include <iostream>
#include <string>
using std :: cin;
using std :: cout;
using std :: endl;
using std :: string;
int main()
{string w1, w2, w;cin >> w1;cin >> w2;w = w1 + " " + w2;cout << w << endl;return 0;
}

3.6 编写一段程序,使用范围for语句将字符串内的所有字符用X代替。

#include <iostream>
#include <string>using std::string;
using std::cin;
using std::cout;
using std::endl;int main()
{string s = "Hello World!";for(auto &c : s)c = 'X';cout << s << endl;return 0;
}

3.7 就上一题完成的程序而言,如果将循环控制变量的类型设为char将发生什么?先估计一下结果,然后实际编程进行验证。

#include <iostream>
#include <string>using std::string;
using std::cin;
using std::cout;
using std::endl;int main()
{string s = "Hello World!";for(char &c : s)c = 'X';cout << s << endl;return 0;
}

3.8 分别用while循环和传统的for循环重写第一题的程序,你觉得哪种形式更好呢?为什么?

#include <iostream>
#include <string>using std::string;
using std::cin;
using std::cout;
using std::endl;int main()
{string s = "Hello World!";decltype (s.size()) i = 0;while(i != s.size()){s[i] = 'X';i++;}cout << s << endl;for(i = 0;i != s.size();i++){s[i] = 'X';}cout << s << endl;return 0;
}

3.9 下面的程序有何作用?它合法吗?如果不合法,为什么?

string s;
cout << s[0] << endl;

不合法。使用下标访问空字符串是非法行为。

3.10 编写一段程序,读入一个包含标点符号的字符串,将标点符号去除后输出字符串剩余的部分。

#include <iostream>
#include <string>using std::string;
using std::cin;
using std::cout;
using std::endl;int main()
{string s = "Hello , World!";string re;for(auto x : s){if(!ispunct(x))re = re + x;}cout << re << endl;return 0;
}

3.14 编写一段程序,用cin读入一组整数并把它们存入一个vector对象。

#include <iostream>
#include <string>
#include <vector>using std::cin;
using std::cout;
using std::endl;
using std::vector;int main()
{vector<int> v;int i;while (cin >> i){v.push_back(i);}return 0;
}

3.15 改写上题的程序,不过这次读入的是字符串。

#include <iostream>
#include <string>
#include <vector>using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;int main()
{vector<string> v;string i;while (cin >> i){v.push_back(i);}return 0;
}

3.16 编写一段程序,把练习3.13中vector对象的容量和具体内容输出出来。检验你之前的回答是否正确,如果不对,回过头重新学习3.3.1节(第87页)直到弄明白错在何处为止。

#include <iostream>
#include <string>
#include <vector>using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;int main()
{vector<int> v1;         vector<int> v2(10);     vector<int> v3(10, 42); vector<int> v4{ 10 };     vector<int> v5{ 10, 42 }; vector<string> v6{ 10 };  vector<string> v7{ 10, "hi" };cout << "v1 size:" << v1.size() << endl;cout << "v1 is :" << endl;for (auto i : v1){cout << i << ",";}cout << endl;cout << "v2 size:" << v2.size() << endl;cout << "v2 is :" << endl;for (auto i : v2){cout << i << ",";}cout << endl;cout << "v3 size:" << v3.size() << endl;cout << "v3 is :" << endl;for (auto i : v3){cout << i << ",";}cout << endl;cout << "v4 size:" << v4.size() << endl;cout << "v4 is :" << endl;for (auto i : v4){cout << i << ",";}cout << endl;cout << "v5 size:" << v5.size() << endl;cout << "v5 is :" << endl;for (auto i : v5){cout << i << ",";}cout << endl;cout << "v6 size:" << v6.size() << endl;cout << "v6 is :" << endl;for (auto i : v6){cout << i << ",";}cout << endl;cout << "v7 size:" << v7.size() << endl;cout << "v7 is :" << endl;for (auto i : v7){cout << i << ",";}cout << endl;return 0;
}

3.17 从cin读入一组词并把它们存入一个vector对象,然后设法把所有词都改写为大写形式。输出改变后的结果,每个词占一行。

#include <iostream>
#include <string>
#include <vector>using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;int main()
{vector<string> v;string s;while (cin >> s){v.push_back(s);}for (auto& c1 : v){for (auto& c2 : c1){c2 = toupper(c2);}}for (auto i : v){cout << i << endl;}return 0;
}

3.19 如果想定义一个含有10个元素的vector对象,所有元素的值都是42,请列举出三种不同的实现方法。哪种方法更好呢?为什么?

1:

vector<int> ivec1(10, 42);

2:

vector<int> ivec2{ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 };

3:

vector<int> ivec3;
for (int i = 0; i < 10; ++i)ivec3.push_back(42);

方法1最好。

3.20 读入一组整数并把他们存入一个vector对象,将每对相邻整数的和输出出来。改写你的程序,这次要求先输出第一个和最后一个元素的和,接着输入第二个和倒数第二个元素的和,以此类推。

#include <iostream>
#include <string>
#include <vector>using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;int main()
{vector<int> v0, v1, v2;int i;while (cin >> i){v0.push_back(i);}for (decltype(v0.size()) index = 0; index < v0.size(); index++){cout << v0[index] << " ";}cout << endl;for (decltype(v0.size()) index = 0; index < v0.size() - 1; index++){v1.push_back(v0[index] + v0[index + 1]);}for (decltype(v1.size()) index = 0; index < v1.size(); index++){cout << v1[index] << " ";}cout << endl;for (decltype(v0.size()) index = 0; index < v0.size() / 2 + 1 && index<= v0.size()-1-index; index++){v2.push_back(v0[index] + v0[v0.size() - 1 - index]);}for (decltype(v2.size()) index = 0; index < v2.size(); index++){cout << v2[index] << " ";}cout << endl;return 0;
}

3.21 请使用迭代器重做3.3.3节的第一个练习。

#include <iostream>
#include <string>
#include <vector>using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;int main()
{vector<int> v1;cout << v1.size() << endl;for (auto it = v1.begin(); it != v1.end(); ++it){cout << *it << ",";}cout << endl;vector<int> v2(10);cout << v2.size() << endl;for (auto it = v2.begin(); it != v2.end(); ++it){cout << *it << ",";}cout << endl;vector<int> v3(10, 42);cout << v3.size() << endl;for (auto it = v3.begin(); it != v3.end(); ++it){cout << *it << ",";}cout << endl;vector<int> v4{ 10 };cout << v4.size() << endl;for (auto it = v4.begin(); it != v4.end(); ++it){cout << *it << ",";}cout << endl;vector<int> v5{ 10, 42 };cout << v5.size() << endl;for (auto it = v5.begin(); it != v5.end(); ++it){cout << *it << ",";}cout << endl;vector<string> v6{ 10 };cout << v6.size() << endl;for (auto it = v6.begin(); it != v6.end(); ++it){cout << *it << ",";}cout << endl;vector<string> v7{ 10,"hi" };cout << v7.size() << endl;for (auto it = v7.begin(); it != v7.end(); ++it){cout << *it << ",";}cout << endl;return 0;
}

3.22 修改之前那个输出text第一段的程序,首先把text的第一段全部改成大写形式,然后输出它。

#include <iostream>
#include <string>
#include <vector>using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;int main()
{vector<string> v1{ "aa","bb","cc" };for (auto it = v1.begin(); it != v1.end() && !it->empty(); it++){for(auto &c:*it){ c = toupper(c);}}for (auto it = v1.begin(); it != v1.end() && !it->empty(); it++){cout << *it << ",";}cout << endl;return 0;
}

3.23 编写一段程序,创建一个含有10个整数的vector对象,然后使用迭代器将所有元素的值都变成原来的两倍。输出vector对象的内容,检验程序是否正确。

#include <iostream>
#include <string>
#include <vector>using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;int main()
{vector<int> v1{ 0,1,2,3,4,5,6,7,8,9 };for (auto it = v1.begin(); it != v1.end(); it++){*it = *it * 2;}for (auto it = v1.begin(); it != v1.end(); it++){cout << *it << ",";}cout << endl;return 0;
}

3.24 请使用迭代器重做3.3.3节的最后一个练习。

#include <iostream>
#include <string>
#include <vector>using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;int main()
{vector<int> v0, v1, v2;int i;while (cin >> i){v0.push_back(i);}for (auto it = v0.begin(); it != v0.end() - 1; it++){v1.push_back(*it + *(it + 1));}for (auto ic : v1){cout << ic << ",";}cout << endl;if (v0.size() % 2 == 0){for (auto it = v0.begin(); it != v0.begin() + v0.size() / 2; it++){v2.push_back(*it + *(v0.end() - (it - v0.begin()) - 1));}}else{for (auto it = v0.begin(); it != v0.begin() + v0.size() / 2 + 1; it++){v2.push_back(*it + *(v0.end() - (it - v0.begin()) - 1));}}for (auto ic : v2){cout << ic << ",";}cout << endl;return 0;
}

3.25 3.3.3节划分分数段的程序是使用下标运算符实现的,请利用迭代器改写该程序实现完全相同的功能。

#include <iostream>
#include <string>
#include <vector>using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;int main()
{vector<unsigned> sorces(11, 0);unsigned grade;auto it = sorces.begin();while (cin >> grade){(*(it + grade / 10))++;}for (auto it = sorces.begin(); it != sorces.end(); it++){cout << *it << ",";}cout << endl;return 0;
}

3.31 编写一段程序,定义一个含有10个int的数组,令每个元素的值就是其下标值。

#include <iostream>
#include <string>
#include <vector>using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;int main()
{int va[10];for (size_t index = 0; index < 10; index++){va[index] = index;}for (auto i : va){cout << va[i] << ",";}cout << endl;return 0;
}

3.32 将上一题刚刚创建的数组拷贝给另一数组。利用vector重写程序,实现类似的功能。

#include <iostream>
#include <string>
#include <vector>using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;int main()
{//数组int va[10],va1[10];for (size_t index = 0; index < 10; index++){va[index] = index;}for (size_t index = 0; index < 10; index++){va1[index] = va[index];}for (auto i : va1){cout << va1[i] << ",";}cout << endl;//vectorvector<int> ve;for (decltype(ve.size()) index = 0; index < 10; index++){ve.push_back(index);}vector<int> ve2(ve);for (auto i : ve2){cout << i << ",";}cout << endl;return 0;
}

3.34 假定p1 和 p2 都指向同一个数组中的元素,则下面程序的功能是什么?什么情况下该程序是非法的?

p1 += p2 - p1;

将p1移动(p2-p1)个位置;p1或p2是非法的,该程序就是非法的。

3.35 编写一段程序,利用指针将数组中的元素置为0。

#include <iostream>
#include <string>
#include <vector>using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;int main()
{//数组int va[10],va1[10];for (size_t index = 0; index < 10; index++){va[index] = index;}for (auto i : va){cout << i << ",";}cout << endl;int* p = va;for (size_t index = 0; index < 10; index++ , p++){*p = 0;}for (auto i : va){cout << i << ",";}cout << endl;return 0;
}

3.36 编写一段程序,比较两个数组是否相等。再写一段程序,比较两个vector对象是否相等。

#include <iostream>
#include <string>
#include <vector>#include <iterator>
using namespace std;
bool compareva(int* const vb1,int* const ve1,int* const vb2,int* const ve2)
{if ((ve1 - vb1) == (ve2 - ve1)){return false;}else{for (int* i1 = vb1, *i2 = vb2; i1 != ve1 && i2 != ve2; i1++, i2++){if (*i1 != *i2){return false;}}}return true;
}
int main()
{//数组int v1[6] = { 0,23,66 }, v2[2];if (compareva(v1, end(v1), v2, end(v2))){cout << "equal!" << endl;}else{cout << "No equal!" << endl;}//vectorvector<int> m1 = { 1,2,3,4,5,6 }, m2 = { 1,2,3,4,5,6 };if (m1 == m2){cout << "equal!" << endl;}else{cout << "No equal!" << endl;}return 0;
}

3.39 编写一段程序,比较两个string对象。再编写一段程序,比较两个C风格字符串的内容。

#include <iostream>
#include <string>
#include <vector>#include <iterator>
using namespace std;int main()
{string s1 = "aabbcc", s2 = "aabbcc";if (s1 == s2){cout << "Equal!" << endl;}else{cout << "No equal!" << endl;}char v1[] = { 'a','b','c' }, v2[] = "abc";if (strcmp(v1, v2)){cout << "Equal!" << endl;}else{cout << "No equal!" << endl;}return 0;
}

3.40 编写一段程序,定义两个字符数组并用字符串字面值初始化它们;接着再定义一个字符数组存放前面两个数组连接后的结果。使用strcpy和strcat把前两个数组的内容拷贝到第三个数组当中。

#include <iostream>
#include <cstring>const char cstr1[] = "Hello";
const char cstr2[] = "world!";int main()
{char cstr3[100];strcpy(cstr3, cstr1);strcat(cstr3, " ");strcat(cstr3, cstr2);std::cout << cstr3 << std::endl;
}
Hello world!

3.41 编写一段程序,用整型数组初始化一个vector对象。

#include <iostream>
#include <cstring>
#include <vector>#include <iterator>
using namespace std;int main()
{int v1[] = {1,2,3,4,5,6,7,8,9,10};vector<int> x1(begin(v1), end(v1));for (auto i : x1){cout << i << ",";}cout << endl;return 0;
}

3.42 编写一段程序,将含有整数元素的vector对象拷贝给一个整型数组。

#include <iostream>
#include <cstring>
#include <vector>#include <iterator>
using namespace std;int main()
{vector<int> v1 = {1,2,3,4,5,6,7,8,9,10};int v2[10];for (int index = 0; index < v1.size(); index++){v2[index] = v1[index];}for (auto i : v2){cout << i << ",";}cout << endl;return 0;
}

3.43 编写3个不同版本的程序,令其均能输出ia的元素。版本1使用范围for语句管理迭代过程;版本2和版本3都使用普通for语句,其中版本2要求使用下标运算符,版本3要求使用指针。此外,在所有3个版本的程序中都要直接写出数据类型,而不能使用类型别名、auto关键字和decltype关键字。

#include <iostream>
#include <cstring>
#include <vector>#include <iterator>
using namespace std;int main()
{int v1[2][3] = { 1,2,3,4,5,6 };//1for (int (&i)[3] : v1){for (int j : i){cout << j << ",";}}cout << endl;//2for (int i = 0; i < 2; i++){for (int j = 0; j < 3; j++){cout << v1[i][j] << ",";}}cout << endl;//3for (int(*p)[3] = v1; p != v1 + 2; p++){for (int* q = *p; q != *p + 3; q++){cout << *q << ",";}}cout << endl;return 0;
}

3.44 改写上一个练习中的程序,使用类型别名来代替循环控制变量的类型。

#include <iostream>
#include <cstring>
#include <vector>#include <iterator>
using namespace std;int main()
{using int_row = int[3];int v1[2][3] = { 1,2,3,4,5,6 };//1for (int_row &i : v1){for (int j : i){cout << j << ",";}}cout << endl;//2for (int i = 0; i < 2; i++){for (int j = 0; j < 3; j++){cout << v1[i][j] << ",";}}cout << endl;//3for (int_row *p = v1; p != v1 + 2; p++){for (int* q = *p; q != *p + 3; q++){cout << *q << ",";}}cout << endl;return 0;
}

3.45 再一次改写程序,这次使用auto关键字。

#include <iostream>
#include <cstring>
#include <vector>#include <iterator>
using namespace std;int main()
{int v1[2][3] = { 1,2,3,4,5,6 };//1for (auto &i : v1){for (auto j : i){cout << j << ",";}}cout << endl;//2for (int i = 0; i < 2; i++){for (int j = 0; j < 3; j++){cout << v1[i][j] << ",";}}cout << endl;//3for (auto *p = v1; p != v1 + 2; p++){for (int* q = *p; q != *p + 3; q++){cout << *q << ",";}}cout << endl;return 0;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://xiahunao.cn/news/2809956.html

如若内容造成侵权/违法违规/事实不符,请联系瞎胡闹网进行投诉反馈,一经查实,立即删除!

相关文章

llm的inference(二)

文章目录 Tokenizer分词1.单词分词法2.单字符分词法3.子词分词法BPE(字节对编码&#xff0c;Byte Pair Encoding)WordPieceUnigram Language Model(ULM) embedding的本质推理时的一些指标参考链接 Tokenizer 在使用模型前&#xff0c;都需要将sequence过一遍Tokenizer&#xf…

【JavaScript 漫游】【020】DOM 常用知识点总结

文章简介 DOM 是 JavaScript 操作网页的接口&#xff0c;全称为文档对象模型&#xff08;Document Object Model&#xff09;。DOM 操作是 JavaScript 最常见的任务&#xff0c;离开了 DOM&#xff0c;JavaScript 就无法操作网页。 本篇文章为【JavaScript 漫游】专栏的第 02…

Mybatis总结--传参二

#叫做占位符 Mybatis是封装的JDBC 增强版 内部还是用的jdbc 每遇到一个#号 这里就会变为&#xff1f;占位符 一个#{}就是对应一个问号 一个占位符 用这个对象执行sql语句没有sql注入的风险 八、多个参数-使用Param 当 Dao 接口方法有多个参数&#xff0c;需要通过名称使…

Gemini 模型将被引入Performance Max

每周跟踪AI热点新闻动向和震撼发展 想要探索生成式人工智能的前沿进展吗&#xff1f;订阅我们的简报&#xff0c;深入解析最新的技术突破、实际应用案例和未来的趋势。与全球数同行一同&#xff0c;从行业内部的深度分析和实用指南中受益。不要错过这个机会&#xff0c;成为AI领…

迅为LS2K0500开发板龙芯自主指令系统应用于互联网应用、打印终端、BMC 医疗、数控、通讯、交通等

CPU 迅为LS2K0500开发板采用龙芯2K0500处理器&#xff0c;基于龙芯自主指令系统 (LoongArch) 架构&#xff0c;片内集成64位LA264处理器核。实现ACPI、DVFS/DPM动态电源功耗管理等低功耗技术&#xff0c;支持多种电源级别和唤醒方式&#xff0c;可根据具体应用场景对芯片部分功…

Linux内核网络

文章目录 前言网络协议栈图解功能 发送Linux内核网络数据包图解流程 接收Linux内核网络数据包图解流程 最后 前言 你好&#xff0c;我是醉墨居士&#xff0c;因为Linux内核涉及的内容极多&#xff0c;我们初学者如果一上来就开始深挖细节&#xff0c;很有可能会在Linux内核代码…

时序预测 | Matlab实现基于GRNN广义回归神经网络的光伏功率预测模型

文章目录 效果一览文章概述源码设计参考资料效果一览 文章概述 1.时序预测 | Matlab实现基于GRNN广义回归神经网络的光伏功率预测模型 2.单变量时间序列预测; 3.多指标评价,评价指标包括:R2、MAE、MBE等,代码质量极高; 4.excel数据,方便替换,运行环境2020及以上。 广义回…

抖音短视频:表情包账号的魅力与运营之道以及制作与工具

在短视频的浪潮中&#xff0c;抖音以其独特的创意和趣味性成为了年轻人的最爱。其中&#xff0c;表情包账号更是凭借其生动、形象的表现方式&#xff0c;赢得了众多用户的青睐。本文将深入探讨抖音短视频表情包账号的魅力所在以及如何有效运营。 一、表情包账号的独特魅力 情…

Go的CSP并发模型实现M, P, G简介

GMP概念简介 G: goroutine&#xff08;协程&#xff0c;也叫用户态线程&#xff09; M: 工作线程(内核态线程) P: 上下文(也可以认为是cpu&#xff0c;逻辑cpu数量&#xff0c;可以在程序启动的时候设置这个数量&#xff0c;gomaxprocs函数设置) GMP 模型 在 Go 中&#xff…

深度神经网络中的计算和内存带宽

深度神经网络中的计算和内存带宽 文章目录 深度神经网络中的计算和内存带宽来源原理介绍分析1&#xff1a;线性层分析2&#xff1a;卷积层分析3&#xff1a;循环层总结 来源 相关知识来源于这里。 原理介绍 Memory bandwidth and data re-use in deep neural network computat…

Temu、亚马逊店铺如何快速得到好评?自养号测评下单的秘籍及必备条件。

Temu、亚马逊店铺如何快速得到好评?在这个竞争激烈的电商平台上&#xff0c;好评是店铺吸引顾客、建立良好声誉的关键。快速积累好评不仅能够提高商品的曝光度&#xff0c;也有助于吸引更多潜在顾客的关注。 然而&#xff0c;亚马逊不同于国内电商&#xff0c;对于操纵评论、…

动态规划的时间复杂度优化

作者推荐 视频算法专题 本文涉及知识点 动态规划汇总 优化动态规划的时间复杂度&#xff0c;主要有如下几种&#xff1a; 一&#xff0c;不同的状态表示。 比如&#xff1a;n个人&#xff0c;m顶帽子。 第一种方式&#xff1a;dp[i][mask] ,i表示前i个人已经选择帽子&…

Python in Excel的一些使用心得

获得Python in Excel的preview之后, 就在任意的Excel单元格里可以敲py(来写Python代码了。不过Python in Excel并没有什么专门的文档, 只有一些_Get Started_教程, 比如link 1, link 2, 剩下的就是pandas, matplotlib, seaborn等lib的文章&#xff0c;和Python in Excel并没有什…

linux---安使用nginx

目录 一、编译安装Nginx 1、关闭防火墙&#xff0c;将安装nginx所需要软件包传到/opt目录下 ​编辑2、安装依赖包 3、创建运行用户、组 4、编译安装nginx 5、创建软链接后直接nginx启动 ​编辑 6、创建nginx自启动文件 ​编辑6.1 重新加载配置、设置开机自启并开启服务…

了解Node.js事件循环和事件驱动模型

在前端开发中&#xff0c;Node.js 是一个极其强大的工具&#xff0c;其事件驱动和非阻塞 I/O 的特性使其成为一个热门选择。但要充分发挥 Node.js 的优势&#xff0c;我们必须深入了解其事件循环和事件驱动模型。本文将深入探讨 Node.js 的事件循环机制以及事件驱动模型&#x…

【mysql】linux系统上进行安装操作(记录)

一、卸载自带的mariadb rpm -qa|grep mariadb #查看版本 yum -y remove mariadb版本号 #如mariadb-libs-5.5.52-1.el7.x86_64 删除目录rm -rf /var/lib/mysql/ 二、mysql安装 2.1 Mysql下载 https://dev.mysql.com/downloads/mysql/5.6.html#downloads 安装参考网址https…

为什么要学习PMP知识,PMP培训哪家好?

IT行业项目管理一枚&#xff0c;曾在做技术的时候对自己的职业发展越来越迷茫&#xff0c;不想干到35岁就参与到失业潮中&#xff0c;一直在想着办法提升自己的能力和竞争力&#xff0c;直到在领导嘴里了解到了PMP认证。也就是它对我的职业发展带来了不少的影响&#xff0c;这其…

美联储突然降息无望

作者&#xff1a;秦晋 我们知道&#xff0c;影响比特币未来1-2年市场走向的重要三因素是比特币ETF、比特币减半以及美联储降息。 如果说前两者是影响比特币市场比较紧密的微观因素。那么美联储降息就是影响比特币市场的重要宏观因素。如何看懂宏观因素&#xff1f;尽量倾听和观…

【openGL教程08】基于C++的着色器(02)

LearnOpenGL - Shaders 一、说明 着色器是openGL渲染的重要内容&#xff0c;客户如果想自我实现渲染灵活性&#xff0c;可以用着色器进行编程&#xff0c;这种程序小脚本被传送到GPU的显卡内部&#xff0c;起到动态灵活的着色作用。 二、着色器简述 正如“Hello Triangle”一章…

CSS3移动端(介绍、Chrome DevTools、视口、倍图、backgroud-size、开发方案、CSS初始化、特殊样式)

目录 1. 介绍2. Chrome DevTools移动端调试3. 视口3.1 布局视口layout viewport3.2 视觉视口visual viewport3.3 理想视口ideal viewport 4. 倍图4.1 图片的倍图使用4.2 背景图通过backgroud-size使用倍图4.3 精灵图作为背景图注意事项 5. 开发方案6. CSS初始化7. 特殊样式 1. …