当前位置: 首页 > news >正文

【Essential C++课后练习】纯代码(更新中)

文章目录

  • 第一章 C++编程基础
    • 1.4
    • 1.5
    • 1.6
    • 1.7
    • 1.8
  • 第二章 面向过程的编程风格
    • 2.1
    • 2.2
    • 2.3
    • 2.4
    • 2.5
    • 2.6

第一章 C++编程基础

1.4

/*********************************************************************说明:试着扩充这个程序的内容:(1)要求用户同时输入名字(first name)和姓氏(last name),
(2)修改输出结果,同时打印出姓氏和名字。
*********************************************************************/
#include <iostream>
#include <string>
using namespace std;int main() {string user_name;cout << "输入名字:\n";cin >> user_name;cout << "\n你好," << user_name;return 0;
}

1.5

/*********************************************************************说明:编写一个程序,能够询问用户的姓名,并读取用户所输入的内容。请确保用户输入的名称长度大
于两个字符。如果用户的确输入了有效名称,就响应一些信息。请以两种方式实现:第一种使用
C-style字符串,第二种使用string对象。
*********************************************************************/
#include <iostream>
#include <string>
#include <cstring>
using namespace std;//使用string对象
int main() {string usr_name;cout << "Please enter your name:" << endl;cin >> usr_name;switch (usr_name.size()) {case 0:cout << "Fail,No Name.";break;case 1:cout << "Fail,Onlu A 1-character name.";break;default :cout << "Hello," << usr_name << endl;}return 0;
}

1.6

/*********************************************************************说明:编写一个程序,从标准输入设备读取一串整数,并将读入的整数依次放到array及
vector,然后遍历这两种容器,求取数值总和。将总和及平均值输出至标准输出设备
*********************************************************************/
#include <iostream>
#include <vector>
using namespace std;// 使用array实现
//int main() {
//	const int array_size = 128;
//	int ia[array_size];
//
//	int ival, icnt = 0;  // ival用于暂存输入,icnt表示输入数据量
//	int sum = 0;
//	cout << "Please Enter Some Numbers:" << endl;
//
//	while (cin >> ival && icnt < array_size) {
//		ia[icnt++] = ival;
//	}
//
//	for (int i = 0; i < icnt; i++) {
//		sum += ia[i];
//	}
//	int average = sum / icnt;
//	cout << "Sum of " << icnt
//	     << " elements: " << sum
//	     << ". Average: " << average << endl;
//	return 0;
//}//使用vector实现
int main() {const int array_size = 128;vector<int>ia; //无需在初始化的时候就确实大小int ival = 0;  // ival用于暂存输入int sum = 0;cout << "Please Enter Some Numbers:" << endl;while (cin >> ival && ia.size() < array_size) {ia.push_back(ival);}for (int i = 0; i < ia.size(); i++) {sum += ia[i];}int average = sum / ia.size();cout << "Sum of " << ia.size()<< " elements: " << sum<< ". Average: " << average << endl;return 0;
}

1.7

/*********************************************************************说明:使用你最趁手的编辑工具,输入两行(或更多)文字并存盘。然后编写一个程序,打开该文本文
件,将其中每个字都读取到一个vector<string>对象中。遍历该vector,将内容显示到cout。
然后利用泛型算法sort(),对所有文字排序:
#include <algorithm>
sort( container.beginer(), container.end() );
再将排序后的结果输出到另一个文件。*********************************************************************/
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;int main() {vector<string>istr;ifstream infile("ex1.7Read.txt");if (!infile) {cerr << "Fail infile!\n";} else {string word;while (infile >> word) {istr.push_back(word);}}// 排序sort(istr.begin(), istr.end());ofstream outfile("ex1.7Write.txt", ios_base::app);if (!outfile)cerr << "Fail outfile!\n";elsefor (int i = 0; i < istr.size(); i++) {outfile << istr[i] << " ";}outfile << endl;return 0;
}

1.8

/*********************************************************************说明:switch语句让我们得以根据用户答错的次数提供不同的安慰语句。请以array储存四种
不同的字符串信息,并以用户答错次数作为array的索引值,以此方式来显示安慰语句。
*********************************************************************/
#include <iostream>
using namespace std;const char *msg_to_usr( int num_tries ) {const int rsp_cnt = 5;static const char *usr_msgs[ rsp_cnt ] = {"Go on, make a guess. ","Oops! Nice guess but not quite it.","Hmm, Sorry. Wrong a second time.","Ah, this is harder than it looks, no?","It must be getting pretty frustrating by now!"};if ( num_tries < 0 ) {num_tries = 0;} else if ( num_tries >= rsp_cnt ) {num_tries = rsp_cnt - 1;}return usr_msgs[ num_tries ];
}int main() {cout << msg_to_usr(3) << endl;return 0;
}

第二章 面向过程的编程风格

2.1

/*********************************************************************说明: 先前的main()只让用户输入一个位置值,然后便结束程序。如果用户想取得两个甚至更多元素值,
他必须执行这个程序两次或多次。请改写main(),使它允许用户不断输入位置值,直到用户希望
停止为止。
*********************************************************************/
#include <iostream>
using namespace std;bool fibon_elem(int, int &);int main() {int pos, elem;char ch;bool more = true;while (more) {cout  << "请输入一个位置:" ;cin >> pos;if (fibon_elem(pos, elem)) {cout << "此位置:" << pos<< "的值是:" << elem << endl;} else {cout << "error";}cout << "是否还要继续(Y/N)?" << endl;cin >> ch;if (ch != 'y' && ch != 'Y') {more = false;}}return 0;
}bool fibon_elem(int pos, int &elem) {// 检查位置值是否合理if (pos <= 0 || pos > 1024) {elem = 0;return false;}// 位置值为1和2时,elem的值为1int val = 1;int n_1 = 1, n_2 = 1;switch (pos) {default:case 2:cout << "1 ";case 1:cout << "1 ";}for (int i = 3; i <= pos; i++) {val = n_2 + n_1;n_2 = n_1;n_1 = val;cout << val << (!(i % 10) ? "\n\t" : " ");}elem = val;return true;
}

2.2

/*********************************************************************说明:Pentagonal数列的求值公式是 Pn=ni*(3r-1) /2,借此产生1,5,12,22,35等元素值。试定义一个函数,利用上述公式,将产生的元素置人用户传入的 vector 之中,元素数目由用户指定。请检查元素数目的有效性(译注:太大则可能引发overflow问题).接下来撰写第二个函数,能够将所接获的 vector 的所有元素一-一印出。此函数的第二参数接受一个字符串,表示储存于vector 内的数列的类型。最后再写一个main( ),测试上述两个函数。
*********************************************************************/
#include <iostream>
#include <vector>
#include <fstream>using namespace std;bool calc_elems(vector<int> &vec, int pos);
void display_elems(vector<int> vec, ostream &os = cout);int main() {vector<int> pent;// 检查上面声明的两个函数if ( calc_elems( pent, 0 ))display_elems( pent );if ( calc_elems( pent, 8 ))display_elems( pent );ofstream ofil("ex2.2.txt");if ( calc_elems( pent, 14 ))display_elems( pent, ofil);if ( calc_elems( pent, 138 ))display_elems( pent );return 0;
}bool calc_elems(vector<int> &vec, int pos) {if (pos <= 0 || pos > 64) {cerr << "Sorry. Invaild position:" << pos << endl;return false;}for (int ix = vec.size() + 1; ix <= pos; ++ix) {vec.push_back((ix * (3 * ix - 1)) / 2);};return true;
};void display_elems(vector<int> vec, ostream &os) {os << "\nPentagonal Numeric Series\n\t";for (int ix = 0; ix < vec.size(); ++ix)os << vec[ix] << ' ';os << endl;
};

2.3

/*********************************************************************说明:将练习2.2的Pentagonal数列求值函数拆分为两个函数,其中之一为inline,用来检验元素个数
是否合理。如果的确合理,而且尚未被计算,便执行第二个函数,执行实际的求值工作。
*********************************************************************/
#include <iostream>
#include <vector>
#include <fstream>using namespace std;inline bool calc_elems(vector<int> &vec, int pos);
extern void really_calc_elems(vector<int> &vec, int pos);
void display_elems(vector<int> vec, ostream &os = cout);int main() {vector<int> pent;// 检查上面声明的两个函数if ( calc_elems( pent, 0 ))display_elems( pent );if ( calc_elems( pent, 8 ))display_elems( pent );ofstream ofil("ex2.3.txt");if ( calc_elems( pent, 14 ))display_elems( pent, ofil);if ( calc_elems( pent, 138 ))display_elems( pent );return 0;
}bool calc_elems(vector<int> &vec, int pos) {if (pos <= 0 || pos > 64) {cerr << "Sorry. Invaild position:" << pos << endl;return false;}if ( vec.size() < pos) {really_calc_elems( vec, pos);}return true;
};void really_calc_elems(vector<int> &vec, int pos) {for (int ix = vec.size() + 1; ix <= pos; ++ix) {vec.push_back((ix * (3 * ix - 1)) / 2);};
}void display_elems(vector<int> vec, ostream &os) {os << "\nPentagonal Numeric Series\n\t";for (int ix = 0; ix < vec.size(); ++ix)os << vec[ix] << ' ';os << endl;
};

2.4

/*********************************************************************说明:写一个函数,以局部静态(local static)的vector存储 Pentagonal数列元素。此函数返回一个const 指针,指向该vector。如果 vector 的容量小于指定的元素数目,就扩充 vector的容量。接下来再实现第二个函数,接受一个位置值并返回该位置上的元素。最后,撰写main ()测试这些函数。*********************************************************************/
#include <iostream>
#include <vector>
#include <fstream>
using namespace std;inline bool check_validity(int pos);
const vector<int> *initelems(int pos);
void display_elems(vector<int> vec, ostream &os = cout);
bool get_elems(int pos, int &elem);int main() {int elem;// 检查上面声明的两个函数if ( get_elems( 0, elem ))cout << "element 1 is " << elem << '\n';for (int i = 1; i <= 10; ++i ) {if ( get_elems( i, elem ))cout << "element " << i << "\tis " << elem << '\n';}return 0;
}bool check_validity(int pos) {return (pos <= 0 || pos > 64) ? false : true;
}const vector<int> *initelems(int pos) {static vector<int> elems;if (check_validity(pos) || pos > elems.size()) {for (int ix = elems.size() + 1; ix <= pos; ++ix) {elems.push_back((ix * (3 * ix - 1)) / 2);};}return &elems;
}bool get_elems(int pos, int &elem) {if ( !check_validity( pos )) {cout << "Sorry. Invalid position: " << pos << endl;elem = 0;return false;};const vector<int> *elems = initelems(pos);elem = (*elems)[pos - 1];return true;
}void display_elems(vector<int> vec, ostream &os) {os << "\nPentagonal Numeric Series\n\t";for (int ix = 0; ix < vec.size(); ++ix)os << vec[ix] << ' ';os << endl;
};

2.5

/*********************************************************************说明:实现一个重载的max (〉函数,让它接受以下参数:(a)两个整数;(b)两个浮点数;(c)两个字符串:(d)一个整数vector;(e)一个浮点数vector:(f)一个字符串 vector;(g)一个整数数组,以及一个表示数组大小的整数值:(h)一个浮点数数组,以及一个表示数组大小的整数值:(i)-个字符串数组,以及一个表示数组大小的整数值.最后,撰写main()测试这些函数。
*********************************************************************/
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;inline int max (int a, int b);
inline float max (float a, float b);
inline string max (const string &a, const string &b);
inline int max (const vector<int> &vec);
inline float max ( const vector<float> &vec );
inline string max ( const vector<string> &vec );
inline string max ( const string &a, const string &b );
inline int max ( const int *parray, int size );
inline float max( const float *parray, int size );
inline string max ( const string *parray, int size );int main() {string sarray[] = { "we", "were", "her", "pride", "of", "ten" };vector<string> svec( sarray, sarray + 6 );int iarray[] = { 12, 70, 2, 169, 1, 5, 29 };vector<int> ivec( iarray, iarray + 7 );float farray[] = { 2.5, 24.8, 18.7, 4.1, 23.9 };vector<float> fvec( farray, farray + 5 );int imax = max( max( ivec ), max( iarray, 7 ));float fmax = max( max( fvec ), max( farray, 5 ));string smax = max( max( svec ), max( sarray, 6 ));cout << "imax should be 169  -- found: " << imax << '\n'<< "fmax should be 24.8 -- found: " << fmax << '\n'<< "smax should be were -- found: " << smax << '\n';return 0;
}int max (int a, int b) {return (a > b) ? a : b;
}float max (float a, float b) {return (a > b) ? a : b;
}string max ( const string &a, const string &b ) {return a > b ? a : b;
}int max ( const vector<int> &vec ) {return *max_element( vec.begin(), vec.end() );
}float max ( const vector<float> &vec ) {return *max_element( vec.begin(), vec.end() );
}string max ( const vector<string> &vec ) {return *max_element( vec.begin(), vec.end() );
}int max ( const int *parray, int size ) {return *max_element( parray, parray + size );
}float max( const float *parray, int size ) {return *max_element( parray, parray + size );
}string max ( const string *parray, int size ) {return *max_element( parray, parray + size );
}

2.6

/*********************************************************************说明:以template 重新完成练习2.5,并对main(〉函数做适度的修改.
*********************************************************************/
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;template <typename Type>inline Type mymax(Type t1, Type t2) {return (t1 > t2) ? t1 : t2;
}template <typename elemType>inline elemType mymax(const vector<elemType> &vec) {return *max_element( vec.begin(), vec.end() );
}template <typename arrayType>inline arrayType mymax(const arrayType *parray, int size) {return *max_element( parray, parray + size );
}int main() {string sarray[] = { "we", "were", "her", "pride", "of", "ten" };vector<string> svec( sarray, sarray + 6 );int iarray[] = { 12, 70, 2, 169, 1, 5, 29 };vector<int> ivec( iarray, iarray + 7 );float farray[] = { 2.5, 24.8, 18.7, 4.1, 23.9 };vector<float> fvec( farray, farray + 5 );int imax = mymax( mymax( ivec ), mymax( iarray, 7 ));float fmax = mymax( mymax( fvec ), mymax( farray, 5 ));string smax = mymax( mymax( svec ), mymax( sarray, 6 ));cout << "imax should be 169  -- found: " << imax << '\n'<< "fmax should be 24.8 -- found: " << fmax << '\n'<< "smax should be were -- found: " << smax << '\n';return 0;
}

相关文章:

【Essential C++课后练习】纯代码(更新中)

文章目录 第一章 C编程基础1.41.51.61.71.8 第二章 面向过程的编程风格2.12.22.32.42.52.6 第一章 C编程基础 1.4 /*********************************************************************说明:试着扩充这个程序的内容&#xff1a;&#xff08;1&#xff09;要求用户同时输…...

C#仿热血江湖GClass

目录 1 C#仿热血江湖GClass 1.1 GClass32 1.2 method_4 1.3 smethod_0 C#仿热血江湖GClass public class GClass32 { private byte[] byte_0;...

[SQL智慧航行者] - 用户购买商品推荐

话不多说, 先看数据表信息. 数据表信息: employee 表, 包含所有员工信息, 每个员工有其对应的 id, salary 和 departmentid. --------------------------------- | id | name | salary | departmentid | --------------------------------- | 1 | Joe | 70000 | 1 …...

Idea配置Scala开发环境

1.首先安装scala插件&#xff1a; File--->Setting---->plugins,在输入框中输入scala&#xff0c;然后点击“Install”即可安装scala&#xff0c;需要稍微等待几分钟。 2 创建项目&#xff1a; File ---->new---->project-----Maven--->Next----输入名称(test…...

LT8711UXD 是一款高性能双通道 Type-C/DP1.4 至 HDMI2.0 转换器

LT8711UXD 1.描述 LT8711UXD是一款高性能的双车道TypeC/DP1.4到HDMI2.0转换器&#xff0c;设计用于将USB Type-C源或DP1.4源连接到HDMI2.0接收器。LT8711UXD集成了一个DP1.4兼容的接收机&#xff0c;和一个HDMI2.0兼容的发射机。此外&#xff0c;还包括两个CC控制器&#xff0…...

Android APK体积优化(瘦身)

1、基础知识&#xff1a; 1.1 apk结构 lib &#xff1a;存放so文件&#xff0c;对应不同的cpu架构 res &#xff1a;资源文件&#xff0c;layout、drawable等&#xff0c;经过aapt编译 assets &#xff1a;资源文件&#xff0c;不经过aapt编译 classes.dex &#xff1a;dx编译…...

python技术栈 之 单元测试中mock的使用

一、什么是mock&#xff1f; mock测试就是在测试过程中&#xff0c;对于某些不容易构造或者不容易获取的对象&#xff0c;用一个虚拟的对象来创建以便测试的测试方法。 二、mock的作用 特别是开发过程中上下游未完成的工序导致当前无法测试&#xff0c;需要虚拟某些特定对象…...

python 提取冒号和逗号内的字符串

如果你想要从字符串中提取冒号和逗号之间的内容&#xff0c;你可以使用正则表达式来完成。以下是使用 Python 的re模块进行提取的示例&#xff1a; import retext 这是一个包含:冒号,逗号:的字符串# 使用正则表达式匹配冒号和逗号之间的内容 pattern r[:](.*?)[,] matches …...

CentOS安装Postgresql

PG基本安装步骤 安装postgresql&#xff1a; sudo yum install postgresql-server初始化数据库&#xff1a;安装完毕后&#xff0c;需要初始化数据库并创建初始用户&#xff1a; sudo postgresql-setup initdb启动和停止服务&#xff1a; sudo systemctl start postgresql sudo…...

云原生可观测框架 OpenTelemetry 基础知识(架构/分布式追踪/指标/日志/采样/收集器)...

什么是 OpenTelemetry&#xff1f; OpenTelemetry 是一个开源的可观测性框架&#xff0c;由云原生基金会(CNCF)托管。它是 OpenCensus 和 OpenTracing 项目的合并。旨在为所有类型的可观测信号(如跟踪、指标和日志)提供单一标准。 https://opentelemetry.iohttps://www.cncf.io…...

多用户跨境电商商品库系统快速搭建(全开源)

搭建一个多用户跨境电商商品库系统需要以下步骤&#xff1a; 1. 确定系统需求&#xff1a;首先&#xff0c;需要明确系统的功能需求&#xff0c;包括商品管理、订单管理、用户管理、支付管理等。根据具体需求确定系统的功能和界面设计。 2. 确定技术栈&#xff1a;选择合适的…...

DataGrip 配置 HiveServer2 远程连接访问

文章目录 集群配置 HiveServer2 服务DataGrip 配置 HiveServer2 访问 Hive 集群配置 HiveServer2 服务 1.在 Hive 的配置文件 hive-site.xml 中添加如下参数&#xff1a; <!-- 指定 HiveServer2 运行端口&#xff0c;默认为&#xff1a;10000 --><property><na…...

异常的使用

第一章 异常 1、异常概念 异常&#xff0c;就是不正常的意思。在生活中&#xff1a;医生说&#xff0c;你的身体某个部位有异常&#xff0c;该部位和正常相比有点不同&#xff0c;该部位的功能将受影响&#xff0c;在程序中的意思就是&#xff1a; 异常&#xff1a;指的是程序…...

软件安全测试包含哪些内容和方法?安全测试报告的必要性

软件安全测试是一种通过模拟真实攻击的方式&#xff0c;对软件系统进行全面的安全性评估和测试&#xff0c;以发现潜在的安全漏洞和弱点&#xff0c;是确保软件系统安全性的重要措施。在进行软件安全测试时&#xff0c;我们需要了解测试的内容和方法&#xff0c;以及为什么进行…...

【代码随想录-leetcode第四题 20.有效的括号】

题目描述 给定一个只包括 ‘(’&#xff0c;‘)’&#xff0c;‘{’&#xff0c;‘}’&#xff0c;‘[’&#xff0c;‘]’ 的字符串 s &#xff0c;判断字符串是否有效。 有效字符串需满足&#xff1a;左括号必须用相同类型的右括号闭合。左括号必须以正确的顺序闭合。每个右…...

造个轮子-任务调度执行小框架-IOC容器实现

文章目录 前言使用场景特性项目结构初始化执行流程可替换核心组件容器创建扫描目标包容器实例BeanDefinitionMap 创建过滤并初始化创建对象依赖注入完整代码前言 忙里偷闲,今天终于是把概率论这块骨头干下来了。所以的话,留了点时间,把整个项目的结构和基本的功能给实现以下…...

npm发包中一些操作备忘

1、npm发布相关命令 发布 npm publish 发布beta版 npm publish --tag beta 取消发布 npm unpublish --force 2、lerna发布相关命令 发布 lerna publish 其他的的官方文档里面比较全 lerna中文文档...

15_基于Flink将pulsar数据写入到ClickHouse

3.8.基于Flink将数据写入到ClickHouse 编写Flink完成数据写入到ClickHouse操作, 后续基于CK完成指标统计操作 3.8.1.ClickHouse基本介绍 ClickHouse 是俄罗斯的Yandex于2016年开源的列式存储数据库&#xff08;DBMS&#xff09;&#xff0c;使用C语言编写&#xff0c;主要用…...

Pycharm如何打断点进行调试?

断点调试&#xff0c;是编写程序中一个很重要的步骤&#xff0c;有些简单的程序使用print语句就可看出问题&#xff0c;而比较复杂的程序&#xff0c;函数和变量较多的情况下&#xff0c;这时候就需要打断点了&#xff0c;更容易定位问题。 一、添加断点 在代码的行标前面&…...

微服务02-docker

1、Docker架构 1.1 镜像和容器 Docker中有几个重要的概念&#xff1a; 镜像&#xff08;Image&#xff09;&#xff1a;Docker将应用程序及其所需的依赖、函数库、环境、配置等文件打包在一起&#xff0c;称为镜像。Docker镜像是用于创建 Docker 容器的模板 。就像面向对象编…...

DeepSeek 赋能智慧能源:微电网优化调度的智能革新路径

目录 一、智慧能源微电网优化调度概述1.1 智慧能源微电网概念1.2 优化调度的重要性1.3 目前面临的挑战 二、DeepSeek 技术探秘2.1 DeepSeek 技术原理2.2 DeepSeek 独特优势2.3 DeepSeek 在 AI 领域地位 三、DeepSeek 在微电网优化调度中的应用剖析3.1 数据处理与分析3.2 预测与…...

C++:std::is_convertible

C++标志库中提供is_convertible,可以测试一种类型是否可以转换为另一只类型: template <class From, class To> struct is_convertible; 使用举例: #include <iostream> #include <string>using namespace std;struct A { }; struct B : A { };int main…...

1688商品列表API与其他数据源的对接思路

将1688商品列表API与其他数据源对接时&#xff0c;需结合业务场景设计数据流转链路&#xff0c;重点关注数据格式兼容性、接口调用频率控制及数据一致性维护。以下是具体对接思路及关键技术点&#xff1a; 一、核心对接场景与目标 商品数据同步 场景&#xff1a;将1688商品信息…...

【单片机期末】单片机系统设计

主要内容&#xff1a;系统状态机&#xff0c;系统时基&#xff0c;系统需求分析&#xff0c;系统构建&#xff0c;系统状态流图 一、题目要求 二、绘制系统状态流图 题目&#xff1a;根据上述描述绘制系统状态流图&#xff0c;注明状态转移条件及方向。 三、利用定时器产生时…...

大学生职业发展与就业创业指导教学评价

这里是引用 作为软工2203/2204班的学生&#xff0c;我们非常感谢您在《大学生职业发展与就业创业指导》课程中的悉心教导。这门课程对我们即将面临实习和就业的工科学生来说至关重要&#xff0c;而您认真负责的教学态度&#xff0c;让课程的每一部分都充满了实用价值。 尤其让我…...

selenium学习实战【Python爬虫】

selenium学习实战【Python爬虫】 文章目录 selenium学习实战【Python爬虫】一、声明二、学习目标三、安装依赖3.1 安装selenium库3.2 安装浏览器驱动3.2.1 查看Edge版本3.2.2 驱动安装 四、代码讲解4.1 配置浏览器4.2 加载更多4.3 寻找内容4.4 完整代码 五、报告文件爬取5.1 提…...

MySQL 索引底层结构揭秘:B-Tree 与 B+Tree 的区别与应用

文章目录 一、背景知识&#xff1a;什么是 B-Tree 和 BTree&#xff1f; B-Tree&#xff08;平衡多路查找树&#xff09; BTree&#xff08;B-Tree 的变种&#xff09; 二、结构对比&#xff1a;一张图看懂 三、为什么 MySQL InnoDB 选择 BTree&#xff1f; 1. 范围查询更快 2…...

libfmt: 现代C++的格式化工具库介绍与酷炫功能

libfmt: 现代C的格式化工具库介绍与酷炫功能 libfmt 是一个开源的C格式化库&#xff0c;提供了高效、安全的文本格式化功能&#xff0c;是C20中引入的std::format的基础实现。它比传统的printf和iostream更安全、更灵活、性能更好。 基本介绍 主要特点 类型安全&#xff1a…...

uniapp 集成腾讯云 IM 富媒体消息(地理位置/文件)

UniApp 集成腾讯云 IM 富媒体消息全攻略&#xff08;地理位置/文件&#xff09; 一、功能实现原理 腾讯云 IM 通过 消息扩展机制 支持富媒体类型&#xff0c;核心实现方式&#xff1a; 标准消息类型&#xff1a;直接使用 SDK 内置类型&#xff08;文件、图片等&#xff09;自…...

深度剖析 DeepSeek 开源模型部署与应用:策略、权衡与未来走向

在人工智能技术呈指数级发展的当下&#xff0c;大模型已然成为推动各行业变革的核心驱动力。DeepSeek 开源模型以其卓越的性能和灵活的开源特性&#xff0c;吸引了众多企业与开发者的目光。如何高效且合理地部署与运用 DeepSeek 模型&#xff0c;成为释放其巨大潜力的关键所在&…...