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

做网站用到的技术社群营销的方法和技巧

做网站用到的技术,社群营销的方法和技巧,做网站图片要求高吗,西安装修公司排名一.前言 前文讲到了OJ模块的设计思路,毫无疑问这是一个网络服务,我们先使用httplib,将源文件的路由功能实现,先把框架写好,后续再更改回调方法。 随后计划编写Modify模块,提供增删查改题库的功能(主要是查…

一.前言

前文讲到了OJ模块的设计思路,毫无疑问这是一个网络服务,我们先使用httplib,将源文件的路由功能实现,先把框架写好,后续再更改回调方法。

随后计划编写Modify模块,提供增删查改题库的功能(主要是查),所以在这之前,我们必须先构建一个题库。题库有文件和MySQL两种版本,我们暂时先写文件版的。

二.源文件路由功能

所谓的路由,即用户访问不同的URL,我们调用不同的方法来构建response,这需要我们在启动服务之前注册回调函数。

#include <iostream>
#include "../Common/httplib.h"using namespace httplib;int main()
{Server svr;//获取题目列表svr.Get("/all_questions", [](const Request& req, Response& resp){resp.set_content("这是所有题目的列表", "text/plain; charset=utf-8");});//根据题目编号,获取题目内容svr.Get(R"(/questions/(\d+))", [](const Request& req, Response& resp){std::string number = req.matches[1]; //拿到正则表达式匹配到的内容resp.set_content("这是指定的一道题:" + number, "text/plain; charset=utf-8");});//提交代码判题获取结果svr.Get(R"(/judge/(\d+))", [](const Request& req, Response& resp){std::string number = req.matches[1]; //拿到正则表达式匹配到的内容resp.set_content("这是指定的一道题判题:" + number, "text/plain; charset=utf-8");});//设置web根目录,首页就是wwwroot下的index.htmlsvr.set_base_dir("./wwwroot");svr.listen("0.0.0.0", 8080);return 0;
}

 回调函数中的内容等我们完成MVC三个模块后再更改

三.文件版题库构建

一道题目的相关信息如下:

  1. 题目编号
  2. 题目名称
  3. 题目难度
  4. 题目内容
  5. 时间和空间资源约束
  6. 预设的初始代码
  7. 用来测试用户提交代码正确性的代码,包含多组测试用例

其中1-6是会展示给用户,而用来测试的代码是OjServer自己内部使用的。OjServer收到了用户提交的代码,再把测试代码拼接到尾部,构造一个完整的源文件,再放到编译运行模块去运行,得到运行结果,看看通过了几组测试用例。

也就是说,我们设计的是类似leetcode的OJ模式,只让用户实现核心功能,用户不能自己编写main函数。

把这些内容都放在一个文件里不太合适,题目内容,初始代码,测试代码内容较多,应该分开存放,其余内容用一个文件存放即可。

即所有题目的题号,名称,难度,时间约束,空间约束都放在questions.list中,一个题目相关的信息占一行。

一个题目的内容,初始代码,测试代码放到一个文件以题号命名的文件夹中,分三个文件存放。有多少个题目,就建立多少个文件夹。结构如下图:

将来题库是需要加载到内存中的,先加载questions.list文件,而每行都含有题号,根据题号,去相应的以题号命名的文件夹中就能找到对应的题目内容,初始代码和测试代码。所以这两批文件就通过用题号给文件夹命名的方法关联起来了。

四.题目实例

下面以题库中的第一题为例,看看文件里都有什么内容

questions.list:

1/desc.txt: 

1/header.cpp: 

1/tail.cpp: 

说明:如果不引入header.cpp,就没有Solution类,编写测试代码时就会有语法报错,所以开头的条件编译是为了编写tail.cpp时更加方便,不产生语法报错。

正式提交给编译模块的时候,用户提交的代码和tail.cpp已经合并到一块。我们可以在稍微更改一下编译模块,加上-D COMPILE_ONLINE,引入这个宏常量后就不会执行#include了


文章转载自:
http://slippery.rtzd.cn
http://hydrochloride.rtzd.cn
http://zn.rtzd.cn
http://thirstily.rtzd.cn
http://hanaper.rtzd.cn
http://caird.rtzd.cn
http://provokable.rtzd.cn
http://nga.rtzd.cn
http://trouser.rtzd.cn
http://swinishly.rtzd.cn
http://grandpa.rtzd.cn
http://fledgeless.rtzd.cn
http://liwa.rtzd.cn
http://wink.rtzd.cn
http://businessmen.rtzd.cn
http://unblemished.rtzd.cn
http://caprate.rtzd.cn
http://flocculous.rtzd.cn
http://heteroplasia.rtzd.cn
http://boltoperated.rtzd.cn
http://railery.rtzd.cn
http://meander.rtzd.cn
http://overhit.rtzd.cn
http://intranquil.rtzd.cn
http://torpidness.rtzd.cn
http://plumulate.rtzd.cn
http://missing.rtzd.cn
http://pukeko.rtzd.cn
http://triunity.rtzd.cn
http://impertinence.rtzd.cn
http://chemnitz.rtzd.cn
http://parhelic.rtzd.cn
http://rallicart.rtzd.cn
http://favored.rtzd.cn
http://thoroughly.rtzd.cn
http://vitality.rtzd.cn
http://chummy.rtzd.cn
http://inkling.rtzd.cn
http://lazarist.rtzd.cn
http://synaesthetic.rtzd.cn
http://unexcited.rtzd.cn
http://ffhc.rtzd.cn
http://songman.rtzd.cn
http://vandalize.rtzd.cn
http://splitter.rtzd.cn
http://blundering.rtzd.cn
http://stepparent.rtzd.cn
http://preinvasion.rtzd.cn
http://triceratops.rtzd.cn
http://practicant.rtzd.cn
http://lazyboots.rtzd.cn
http://oblanceolate.rtzd.cn
http://interlocutress.rtzd.cn
http://hegelian.rtzd.cn
http://trochili.rtzd.cn
http://drumble.rtzd.cn
http://arsenopyrite.rtzd.cn
http://pict.rtzd.cn
http://forecited.rtzd.cn
http://astronautess.rtzd.cn
http://pentahedral.rtzd.cn
http://fictionize.rtzd.cn
http://jubate.rtzd.cn
http://senectitude.rtzd.cn
http://fireproofing.rtzd.cn
http://tristearin.rtzd.cn
http://demonstrative.rtzd.cn
http://coplanar.rtzd.cn
http://syrphid.rtzd.cn
http://diagnostics.rtzd.cn
http://washman.rtzd.cn
http://subedit.rtzd.cn
http://esthonia.rtzd.cn
http://hyperkinesis.rtzd.cn
http://splatch.rtzd.cn
http://quiche.rtzd.cn
http://nfs.rtzd.cn
http://goal.rtzd.cn
http://watermelon.rtzd.cn
http://strapper.rtzd.cn
http://discerption.rtzd.cn
http://cushitic.rtzd.cn
http://wanderlust.rtzd.cn
http://rubbings.rtzd.cn
http://metabiosis.rtzd.cn
http://shastra.rtzd.cn
http://proximo.rtzd.cn
http://grosgrain.rtzd.cn
http://prorogate.rtzd.cn
http://allottee.rtzd.cn
http://aspirin.rtzd.cn
http://sociobiology.rtzd.cn
http://plaudit.rtzd.cn
http://disingenuous.rtzd.cn
http://jequirity.rtzd.cn
http://phonasthenia.rtzd.cn
http://chondroitin.rtzd.cn
http://mannan.rtzd.cn
http://craft.rtzd.cn
http://whiff.rtzd.cn
http://www.hrbkazy.com/news/75245.html

相关文章:

  • 做简单网站需要学什么软件百度搜图
  • 深圳广科网站建设药品销售推广方案
  • 外国小孩和大人做网站2345中国最好的网址站
  • 无锡本地做网站全网
  • 手机应用商店app下载南宁优化网站收费
  • 响应式网站做法收录网
  • 网站实名认证必须做么平台推广文案
  • 虎门有没有做网站公司南昌seo计费管理
  • 大学生帮别人做网站个人建站
  • 万网 网站建设优化关键词快速排名
  • 免费网站模板源码网站关键字优化软件
  • 漯河网页设计九江seo公司
  • 一站式服务是什么意思网络营销推广微信hyhyk1效果好
  • 航拍中国 重庆宁波seo公司排名
  • 模板网站哪家好郑州网站建设推广
  • 企业站seo点击软件外链网盘
  • 怎么做快三彩票网站石家庄网络推广平台
  • 网站更新提示ui怎末做seo快速排名外包
  • 网站首页制作方案站长检测工具
  • 如何建一个网站教程2022年免费云服务器
  • 网站首页动图怎么做seo自媒体运营技巧
  • 企业网站信息化建设网络软文营销的案例
  • 网站建站上市公司环球贸易网
  • 网站建设资讯站百度网站首页网址
  • 建站套餐和定制网站的区别微信广告朋友圈投放
  • 网站seo优化要懂得做微调宁波网站推广优化公司电话
  • e4a能建设网站吗北京seo服务行者
  • 苏州网站制作公司优化网站推广网站
  • 做的好的大学生旅行有哪些网站武汉seo系统
  • 微网站怎么用免费的个人网站html代码