C++ day1 作业练习

Day.1[贪心训练]—家庭作业(贪心算法&C++快速读) 啊哈,我时隔一年又回来啦😁,准确的说应该是281天。这281天我可是收获满满啊😎,终于抽出来时间给大家学编程的送代码抄了🤣。其实当年我也是靠抄出来的,我抄得多了渐渐的就都会了😜。话不多说,赶快开始今天的讲解吧! 阅读详情

整理思维导图

定义自己的命名空间my_sapce,在my_sapce中定义string类型的变量s1,再定义一个函数完成对字符串的逆置。

#include <iostream>
#include <cstring>

using namespace std;
namespace my_space
{
    string s1;
}

void show()
{
    cout<<"hello"<<endl;
}
void re(char *p)
{
    if(NULL == p){
        return ;
    }
    //abcde
    char *head = p;
    char *tail = p+strlen(p)-1;
    char temp;

    while(head < tail){
        temp = *head;
        *head = *tail;
        *tail = temp;
        head++;
        tail--;
    }
}

int main()
{
    cout<< "请输入字符串:" <<endl;
    cin >> my_space::s1;
    char buf[100];
    strcpy(buf,my_space::s1.data());

    re(buf);
    cout<< buf<< endl;

    return 0;
}

手把手教你学Simulink——基于AI融合与智能调度的场实例:强化学习在卫星资源分配中的应用 本文详细介绍了如何利用Simulink和强化学习技术实现智能卫星资源分配。文章首先分析了低轨卫星通信系统面临的动态资源调度挑战,提出采用强化学习(特别是PPO算法)的解决方案。接着逐步展示了完整的建模过程:从Simulink项目创建、卫星通信环境建模(用户业务、信道特性、资源池),到强化学习任务定义(状态空间、动作空间、奖励函数),再到PPO智能体的构建与训练。最后通过仿真验证,PPO智能体在系统吞吐量、公平性和阻塞率等关键指标上均优于传统方法。该方案为卫星通信系统的智能资源管理提供了可行方案,并支持进一步 阅读详情

相关推荐

高通camx ThreadManager

m_pCore->AcceptNewJob是将一个Job或者任务插入一个Queue,有一个工作线程循环从Queue中取Job任务执行,执行任务就是回调任务中的callback函数,AcceptNewJob实现。调用AddToPriorityQueue将任务添加到queue任务队列,那么什么时候从这个queue中取任务执行呢?有个线程循环执行DoWork,最终调用checkAndDequeue取任务执行。

GetnextWindow的专栏 435

重生之我在10天内速成C++ - DAY 1

关键词: 环境搭建, Vim, g++, Hello World, 变量, cin/cout。万丈高楼平地起!第一天,我们将为你扫清所有障碍:搭建Linux下的开发环境(Vim, g++),掌握必备的命令行“黑话”,并成功编译运行你的第一个C++程序。你将学会变量、输入输出这些最基本的“积木”,为后续的冒险打下坚实地基。

不会C++、害怕嵌入式且不爱看动漫的小趴菜 1万+

SAP交货单过账避坑指南:序列号处理、Buffer清理与BAPI提交回滚的那些事儿

本文深入解析SAP交货单过账中的序列号处理、Buffer清理与BAPI提交回滚等关键问题,提供WS_DELIVERY_UPDATE和BAPI_OUTB_DELIVERY_CONFIRM_DEC的实战优化方案。通过详细的技术分析和最佳实践,帮助开发者避免常见陷阱,提升交货单处理的稳定性和效率。

weixin_31155097的博客 431

C++核心day3作业

/设置长度//设置宽度//获取长度,将长度的值返回给调用处//获取宽度,将宽度的值返回给调用处//输出周长和面积private:int length;// 私有属性:长度int width;// 私有属性:宽度public:// 设置长度// 设置宽度// 获取长度// 获取宽度// 输出周长和面积length = l;width = w;cout << "周长: " << 2 * (length + width) << endl;

2201_75783063的博客 509

最新测算源码PHP算命源码-风水八字-八字起名-塔罗牌占卜

未来,随着技术的发展和用户需求的变化,我们可以继续对系统进行升级和优化,以满足更多用户的需求和期望。数据库设计:创建一个名为bazi的数据库表,包含以下字段:id(自增ID)、name(姓名)、sex(性别)、birth_date(出生日期)、birth_time(出生时间)、bazi(八字结果)。数据库设计:创建一个包含塔罗牌信息的数据库表,如tarot_cards,包含字段:id(塔罗牌ID)、name(塔罗牌名称)、meaning(塔罗牌含义)等。根据操作系统的不同,PHP的安装方法会有所不同。

shanbeizi的博客 2417

树莓派上基于ONNXRuntime与Qt的C++模型部署实战指南

本文详细介绍了在树莓派上使用ONNXRuntime与Qt进行C++模型部署的完整流程。从环境配置、依赖安装到交叉编译优化,再到Qt界面集成与ARM架构性能调优,提供了实战指南和常见问题解决方案,帮助开发者高效完成边缘设备上的AI应用部署。

ik6789012的博客 339

C++作业day1

提示并输入一个字符串,统计该字符中大写、小写字母个数、数字个数、空格个数以及其他字符个数。要求使用C++风格字符串完成。

m0_74384179的博客 900

手把手教你学simulink(8.2)--simulink的实战案例:信号分析

通过以上步骤,你已经成功使用 Simulink 对信号进行了频谱分析和时域分析,提取了信号的有用信息。这个案例展示了如何创建 Simulink 模型、添加和连接模块、设置仿真参数、运行仿真以及分析结果。希望这个案例能帮助你更好地理解和使用 Simulink 进行信号分析。

MHD0815的博客 1123

腾讯课堂Day2作业

作业链接:C:\Users\Hui\Desktop\w3school\Day2作业\Day2 诗词作业.html   作业代码:   作业成品:

karikk的博客 744

作物生长模型Oryza V3实战9:控制文件参数详解

control.dat是ORYZA水稻模型的核心配置文件,主要包含三部分:1)基础参数设置与模拟时间定义;2)关键文件路径配置,包括土壤参数文件(soil.sol)、作物参数文件(cultivar.crp)、田间管理文件(manage.exp)及气象数据目录,同时指定输出结果文件(res.dat)和运行日志(model.log);3)可选参数和输出控制选项。该文件通过关联各类输入数据(气象、土壤、品种特性等)和输出结果,实现模型运行的全流程控制,支持参数调整后继续模拟和中断恢复功能。

221

免费教你快速学会分析运算放大器电路(保证学会)

本文旨在学习如何快速简单地对运算放大器进行分析

一名热爱技术的工程师的博客。分享技术干货,记录美好生活。永远相信美好的事情即将发生。 1万+

c++day1作业

提示并输入一个字符串,统计该字符中大写、小写字母个数、数字个数、空格个数以及其他字符个数。cout<<"其他符号个数为:"<<other<<endl;cout<<"小写个数为:"<<little<<endl;cout<<"数字个数为:"<<passwd<<endl;cout<<"空格个数为:"<<space<<endl;cout<<"大写个数为:"<<huge<<endl;cout<<"输入一个字符串"<<endl;要求使用C++风格字符串完成。

qq_50842557的博客 612

运行codex时出现登录失败:failed to start login server: 以一种访问权限不允许的方式做了一个访问套接字的尝试。 (os error 10013) 解决方案

的本质是Windows 系统端口保留策略而非代码 bug。推荐使用方案一(调整动态端口范围),一劳永逸解决。如果你安装了 Docker Desktop 或启用了 WSL2,调整端口范围后记得检查相关服务是否正常运行。

一键难忘的博客 4154

0821|C++day1 初步认识C++

QT软件的使用、C++和C的区别、C++和C的区别、命名空间、字符串/C++中的string类、C++中的bool

Smallxu_的博客 1242

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

C++ day4——C++核心(类)

C++ day4——C++核心(类)

2301_77576552的博客 791

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

C++ DLUT 上机作业(一)

C++ DLUT 上机作业(一) 声明:不同老师有不同要求,仅供参考,不喜勿喷 另外,所有代码在Dev C++可运行 1、/*定义一个分数类如下,要求实现分数的初始化与设置、四则运算及约分以及输出等功能,并在主函数中测试。 class Rational{ int m; // 分母 int n; // 分子 public: Rational(int nn=1,int mm=1); //构造 bool setM( int ); // 设置分母,注意不能为零 void setN( int ); /

weixin_51568657的博客 1643

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

c++day1

内存布局:末尾自动添加 \0 终止符,实际内存内容为 {'a', 'b', 'c', 'd', 'f', 'd', 'j', 'g', 'k', '\0'}。cout << "今天是我学习C++的第一天,好开心~" << endl << 10 << endl;// //begin()第一个元素的地址 end()表示最后一个元素的下一个元素的地址。

2301_80665732的博客 311

【c++day1作业】

2)当有多个命名空间变量冲突时,若想要引入A的命名空间的num1,需要使用A::num1格式,或者在引入时,只引入A的命名空间,在使用时直接写成num1。定义了一个指向字符类型的常量指针 ,指针变量p本身不可以修改的,但是可以通过p修改所指向的字符的值。定义了一个指向字符类型常量的指针,指针变量p本身是可以修改的,但是不能通过p修改所指向的字符的值。定义了一个指向字符类型的常量指针,指针变量p本身不可以修改的,但是可以通过p修改所指向的字符的值。3.总结命名空间使用时的方式和注意事项。

m0_52668685的博客 349

C++DAY1

【代码】C++DAY1。

Artorias_Ch的博客 306

C++day2作业

一、C++中的动态分配和回收。

Y_mqm的博客 186

C++ Qt作业 day1

C++ Qt作业 day1

ctf1991的博客 627

day08-智能调度之作业范围

每个营业网点可以在地图上画一个多边形范围(多个坐标点组成,首尾坐标点相同),存储到MongoDB数据库中,使用MongoDB提供的方法intersects(),只需将参数坐标点传入。db.user.find({age:{$lte:21}, id:{$gte:2}}) #and查询,age小于等于21并且id大于等于2。在项目中,会有两个作业范围,分别是机构作业范围和快递员作业范围,这两个作业范围的逻辑是一致的,就是在地图中进行画出范围,就是其作业范围。数据模型即表的字段(MongoDB中1数据a,b字段。

ddd_dhm的博客 1118

day4作业

【代码】day4作业。

2401_85401648的博客 133

C++day1作业

【代码】C++day1作业。

2501_92530734的博客 108

C++day1

【代码】C++day1。

m0_57703246的博客 393

day 4 作业

注意:5/9直接除会使结果为0。

2302_81211062的博客 248
上一篇: 基于UDP的tftp文件传输练习
下一篇: C++ day2 练习
风铃响了
博客等级 码龄4年 76粉丝 56原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值