黑龙江大学程序设计竞赛(重现赛) 个人笔记 题解
版权声明:点个关注(^-^)V https://blog.csdn.net/weixin_41793113/article/details/89923531 题目链接:https://ac.nowcoder.com/acm/contest/877#question A.Find the Nth Character 链接:https://ac.nowcoder.com/acm/contest/877/A 来源:牛客网 题目描述 今天在给 的同学们上程序算法课的时候出了一道找规律的题目,题目表述如
用户自己密码重置后,系统自动退出(total管理端开发)
/** * 当前登录用户修改自己的密码 * @param user * @param vcpd * @return */ @RequestMapping("updatePwd") @ResponseBody public JSONObject updatePwd(HttpServletRequest request,User user) { User us = (User)request.getSession().getAttribute("user"); if(!MD5Util.md5(us
thinkphp5数据库查询构造器视图查询之View
链接查询 view方法 1、功能:视图查询可以实现不依赖数据库视图的多表查询,并不需要数据库支持视图 2、代码截图实例 3、参数与返回值 根据上图可知view方法有4个参数 序号 参数 说明 1 join / 字符串 / 数组 join为字符串是table表名,数组时解析成表名与表别名 2 field / 字符串 / 数组 字符串表示字段列表,数组是包含字段别名 3 on / 字符串 / 数组 多表连接条件 4 type / 字符串 连接类型,默认为INNER内链接,支持LEFT左连接、RIG
Linux网络编程之UDP协议(一版)
最近正在学习网络编程,用UDP来实现服务器端和客户端的收发的简单通信。由于是第一版,所以写的比较粗糙,很多地方都有要改进的地方。例如:包裹函数,把客户端和服务器端共同都包括的头文件,宏都写在一个公共头文件里等等。以后有时间会继续改进。 首先编写服务器端的程序ser_udp.c
#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<string.h>
#include<sys/socket.h>
#include<ne
Linux网络编程之TCP协议(二版)
通用头文件:
#ifndef _UTILI_H
#define _UTILI_H
#include<stdio.h>
#include<unistd.h>
#include<string.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<pthread.h>
#define LISTEN_QUEUE_SIZE 5
//#define LISTE
linux网络编程之IO复用select模式
utili.h:
#ifndef _UTILI_H
#define _UTILI_H
#include<stdio.h>
#include<unistd.h>
#include<string.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<pthread.h>
#define BUFFER_MAX_SIZE 256
#define L
C++ Templates 第一部分阅读笔记
第二章 函数模板 int const N = 100;//const用来修饰前面的int是个常值 int* const book mark;//指针不能改变,指针指向的值是可以改变的 typedef char* CHARS; typedef CHARS const CPTR;//指向char类型的常量指针 typedef char* const CPTR;//仍然是指向char类型的常量指针 同样的规则也适用于volatile限定符 void foo(int const& x);//参数类型和
Linux网络编程之定时器
定时器的头文件lst_timer.h
#ifndef LST_TIMER
#define LST_TIMER
#include <time.h>
#define BUFFER_SIZE 64
class util_timer;
struct client_data //数据域的结构
{
sockaddr_in address;
int sockfd;
char buf[ BUFFER_SIZE ];
util_timer* timer;
};
class
Linux网络编程之处理非活动连接
现实生活中,总有些非正常的客户端(即僵尸客户端),占用服务器的资源。只有杜绝客户端的非活动连接才能有效地提高服务器的效率。
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <assert.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <err
PJ版本STL中的list starded header
// list standard header
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _LIST_
#define _LIST_
#include <cstddef>
#include <functional>
#include <iterator>
#include <memory>
#include <stdexcept>
#include <xutility>
#ifdef _MSC_VER
#pragma pac
初识STL string类
实例化和复制STL string类:
#include <string>
#include <iostream>
int main()
{
using namespace std;
const char* mystring = "hello string"; //C风格的字符串
cout<<"Constant string is : "<<mystring<<endl;
std::string strFromConst(mystring); //构造字符串类
matlab画图的一个小例子
x=0:5:20;
a=[16.3,16.5,16.9,17.1,17.35];
b=[16.3,16.4,16.65,16.9,17.1];
c=[16.3,16.35,16.6,16.8,17.0];
plot(x,a,'-sk',x,b,'-^k',x,c,'-ok');
axis([-2.5,22.5,16.2,17.5])
set(gca,'XTick',[0:2.5:20]) %x轴范围1-6,间隔1
set(gca,'YTick',[16.20:0.10:17.40]) %y轴范
STL中的动态数组类
std::vector的特点 在数组末尾添加元素所需要的时间是固定的 在数组中间添加或是删除元素所需的时间和该元素后面的元素个数成正比 存储的元素数是动态的,而vector类负责内存管理 典型的vector操作 实例化vector
#include <vector>
int main ()
{
// vector of integers
std::vector<int> integers;// 使用了默认的构造函数
// 编译器暂时还不支持这种初始化的方法,这是C++11
STL中迭代器(iterators)概念与traits编程技法
最近在学习jjhou的《STL源码剖析》,侯大师确实功力深厚,把SGI版本的STL解析的很透彻。让我等凡人能有机会窥见一些C++标准模板库的玄妙。看了第三章的内容,于是打算总结一番,方便后续继续学习。 迭代器模式 提供了一种方法,使之能够依序巡访某个聚合物(容器)所含的各个元素,而又无需暴露该聚合物的内部表达方式。 STL中的迭代器 STL的中心思想在于:将数据容器(containers)和算法(algorithms)分开,彼此独立设计,最后再以一贴胶着剂将它们撮合在一起。容器和算法的泛型化,
List的特点和特有功能
List的特点和特有功能 1.特点 A:有序的(存储和读取的顺序是一致的) B:有整数索引 C:允许重复的 2.List的特有功能 void add(int index, E element) :将元素添加到index索引位置上 E get(int index) :根据index索引获取元素 E remove(int index) :根据index索引删除元素 E set(int index, E element):用指定元素替换列表中指定位置的元素,返回以前在指定位置的元素 例如:
pac
LinkedList特有功能
LinkedList特有功能 LinkedList底层使用的是链表结构,因此增删快,查询相对ArrayList较慢 特有功能: void addFirst(E e) :向链表的头部添加元素 void addLast(E e):向链表的尾部添加元素 E getFirst():获取链头的元素,不删除元素 E getLast():获取链尾的元素,不删除元素 E removeFirst():返回链头的元素并删除链头的元素 E removeLast():返回链尾的元素并删除链尾的元素 例如:
pack
Collections中的方法
Collections中的方法 Collections: 面试题:Collection和Collections有什么区别? Collection是集合体系的最顶层,包含了集合体系的共性 Collections是一个工具类,方法都是用于操作Collection 方法: 1.static void swap(List list, int i, int j) :将指定列表中的两个索引进行位置互换 2.static void sort(List<T> list) :按照列表中元素的自然顺序进行排序 3
今日推荐
周排行