自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(40)
  • 收藏
  • 关注

转载 STL源码分析——sort排序

稍微花了一点点时间看了一下老师推荐的博客:http://feihu.me/blog/2014/sgi-std-sort/,看完后无不赞叹STL追求效率之极致,STL的sort排序算法综合了三种排序快排,堆排和插入排序,被称为Introspective Sort(内省式排序),在算法内部根据自身不同的情形来判断来使用不同的算法进行排序,sort算法可以说综合了三种排序算法的优点,追求效率到...

2019-09-21 23:53:00 261

转载 算法第二章上机实践报告

实践题目 7-3两个有序序列的中位数问题描述已知有两个等长的非降序序列S1, S2, 设计函数求S1与S2并集的中位数。有序序列,的中位数指A​(N−1)/2​​的值,即第⌊个数(A​0​​为第1个数)。输入格式:输入分三行。第一行给出序列的公共长度N(0<N≤100000),随后每行输入一个序列的信息,即N个非降序排列的整数。数字用空格间隔。输出格式:...

2019-09-18 21:46:00 150

转载 编码规范与数学之美感想

命名规约代码中的命名均不能以下划线或美元符号开始,也不能以下划线或美元符号结束代码中的命名严禁使用拼音与英文混合的方式,更不允许直接使用中文的方式类名使用UpperCamelCase风格,必须遵从驼峰形式(某些情况诸如领域模型相关的命名除外);方法名、参数名、成员变量、局部变量都统一使用lowerCamelCase风格,必须遵从驼峰形式常量命名全部大写,单词间用下划线隔开...

2019-09-01 11:45:00 209

转载 C++文件输入和创建

1 #include <fstream> 2 //头文件 3 4 5 ifstream inf; 6 ofstream ouf; 7 inf.open("zy4.txt", ios::out); 8 if (!inf) 9 {10 inf.cl...

2019-04-19 21:49:00 272

转载 STL 小白学习(10) map

map的构造函数map<int, string> mapS;数据的插入:用insert函数插入pair数据,下面举例说明mapStudent.insert(pair<int, string>(1, "student_one"));mapStudent.insert(pair<int, string>(2, "student_...

2019-04-07 23:33:00 73

转载 win10php环境变量配置(xampp环境)

我的电脑--属性(右键)--高级系统设置--环境变量--系统变量--Path--编辑新建两条变量:一个是xampp文件下的php文件,例如 C:\xampp\php一个是xampp文件下的php文件下的ext文件,例如 C:\xampp\php\ext记得点2个确定转载于:https://www.cnblogs.com/likeghee/p/103...

2019-02-13 19:37:00 604

转载 composer的安装方法 以及 ThinkPHP5安装

1、下载installer的文件,使用浏览器开启链接:getcomposer.org/installer,下载如下文件到 E:\xs2016\composer, 将installer重命名为composer_installer.phar2、运行cmd ,开启命令行,进入 composer_installer.phar 所在目录输入 PHP composer_inst...

2019-02-13 19:32:00 160

转载 C++中的getline

https://www.cnblogs.com/ymd12103410/p/9514896.html#undefined转载于:https://www.cnblogs.com/likeghee/p/10349341.html

2019-02-02 22:28:00 88

转载 '假定以下程序经编译和连接后生成可执行文件PROG.EXE,如果在此可执行文件所在目录的DOS提示符下键入:PROG ABCDEFGH IJKL<回车>,则输出结果为( ). void main(...

main(int argc,char *argv[])函数的两个形参,第一个int argc,是记录你输入在命令行(你题目中说的操作就是命令行输入)上的字符串个数;第二个*argv[]是个指针数组,存放输入在命令行上的命令(字符串)。当命令行输入PROGABCDEFGHIJKL时,记录了3个字符串(以间隔为界,不含间隔,这是约定),*argv[0]中放的是"PROG",*argv[1...

2019-01-08 19:57:00 1569

转载 对于类:如果其中有指针成员,一定要对其 “=” 和拷贝构造函数进行重载

因为类中的指针成员要分配一个动态的内存空间,当两个对象进行赋值(如:t1=t2),即将一个指针(*p2)给另一个指针成员(*p2);两指针便指向同一内存,一旦对象撤销时,调用析构函数释放空间,便产生内存错误。通过运算符重载,重载“=”运算符,就会先收回p1所指向的空间,再重新给p1分配空间;然后把t2.p2指向的内存copy到t1.p1的内存中。转载于:https://www.cnb...

2019-01-08 15:43:00 371

转载 STL 小白学习(9) 对组

void test01() { //构造方法 pair<int, int> p1(10, 2); cout << p1.first << p1.second << endl; pair<int, string> p2 = make_pair(10, "assd"); co...

2018-12-26 17:59:00 92

转载 STL 小白学习(8) set 二叉树

#include <iostream>using namespace std;#include <set>void printSet(set<int> s) { for (set<int>::iterator it = s.begin(); it != s.end(); it++) { c...

2018-12-26 17:52:00 177

转载 STL 小白学习(7) list

#include <iostream>using namespace std;#include <list>void printList(list<int>& mlist) { for (list<int>::iterator it = mlist.begin(); it != mlis...

2018-12-26 17:20:00 102

转载 STL 小白学习(5) stack栈

#include <iostream>#include <stack>//stack 不遍历 不支持随机访问 必须pop出去 才能进行访问using namespace std;void test01() { //初始化 stack<int> s1; stack<int> s2(s1...

2018-12-26 17:19:00 90

转载 STL 小白学习(6) queue

//queue 一端插入 另一端删除//不能遍历(不提供迭代器) 不支持随机访问#include <queue>#include <iostream>using namespace std;void test01() { queue<int> q1; q1.push(10);//尾部插入 ...

2018-12-26 17:19:00 84

转载 STL 小白学习(4) deque

#include <iostream>#include <deque> //deque容器 双口using namespace std;void printDeque(deque<int>& d) { for (deque<int>::iterator it = d.begin(); it != d...

2018-12-26 17:18:00 72

转载 括号匹配问题 :()[] 难度1

#include <iostream>using namespace std;#include <string>bool ShiPiPei(const char* test) { string s; char str[100]; int topStackIndex = 0; s.assign(test);...

2018-12-25 23:57:00 117

转载 STL 小白学习(3) vector

1 #include <iostream> 2 using namespace std; 3 #include <vector> 4 5 void printVector(vector<int>& v) { 6 for (vector<int>::iterator it = v.beg...

2018-12-24 18:44:00 73

转载 STL 小白学习(2) string

1 #include <iostream> 2 using namespace std; 3 #include <string> 4 5 6 //初始化操作 7 void test01() { 8 //初始化操作 9 string s1; 10 string s2(10, 'a...

2018-12-24 16:46:00 87

转载 STL 小白学习(1) 初步认识

1 #include <iostream> 2 using namespace std; 3 #include <vector> //动态数组 4 #include <algorithm>//算法 5 6 void PrintVector(int v) { 7 cout << v<<"...

2018-12-24 16:45:00 80

转载 sin n次方 x 的降幂公式

A(n) = ∫ sinⁿx dx= ∫ sinⁿ⁻¹xsinx dx= - ∫ sinⁿ⁻¹x d(cosx)= - sinⁿ⁻¹xcosx + ∫ cosx • d(sinⁿ⁻¹)= - sinⁿ⁻¹xcosx + (n - 1)∫ cosx • sinⁿ⁻²x • cosx dx= - sinⁿ⁻¹xcosx + (n - 1)∫ sinⁿ⁻²x • (1 - sin²x) dx=...

2018-12-20 19:28:00 6692

转载 查找结构体数组中的人名是否匹配

void updatePhonenum(contacts student[], int n) {   char sName[100];   char c;   int k = 0;   int t = 0;   int j = 0;   cout << "请输入你要修改手机号的人的名字" << endl;   do {     cin.get(c);     ...

2018-11-25 21:43:00 462

转载 将结构体数组中内容以文件形式的导出

void fileOutput(contacts student[] , int n){   ofstream out ;   out . open("tongxunlu-new.txt") ;   for(int i = 0 ; i<= n-1 ; i++){     out << "学号" << '\t' <<'\t' << s...

2018-11-25 21:38:00 359

转载 python 小白学习(1)

自定义错误类型class XxxError(Exception): def __init__(self , message): self = Exception("xxxxx") // Exception.__init__(self) self.message = message 自行错误抛出...

2018-11-19 17:00:00 97

转载 结构体数组定义与使用

struct student{ int num; char name[20]; ...;}结构体的定义student stud[4];数组变量的定义void input (student &stud){ cout<<"请输入xxx:"; cin>>stud...

2018-11-19 16:31:00 3164

转载 结构体与文件导入

#include <iostream>#include <cstring>#include <fstream>#include <cstdlib>using namespace std;struct student{ // 创建构造体  int num;  char name[20];  ....;...

2018-11-19 16:20:00 196

转载 结构体类型中成员的引用

#include <iostream>using namespace std;#include <sctring>struct student{ // 定义构造体 int num; char name[10]; float score[4];};int main(){ student s...

2018-11-19 16:05:00 459

转载 编写一个函数判断一个整数是否为回文数。如果一个属从正的方向读和从反的方向读的结果相同,则该数就是回文数。...

bool palindrome(int b){   int k = 0;   char a[1000];   do {     int c;     c = b % 10;     char d;     for (int i = 0; i <= 9; i++) {       if (c == i) {       d = '0' + i; break; ...

2018-11-14 22:49:00 3781

转载 cin.get()函数使用例子

#include <iostream>using namespace std;int k = 0;int main(){   char a[1000];   char c;   do    {     cin.get(c);     a[k++] = c;   }while (c!='\n'); }转载于:https://www.cnblogs.com/l...

2018-11-14 22:13:00 218

转载 编写一个函数实现数制转换。在主函数中输人一个十进制数,输出相应的十六进制数。要求用数组实现...

void decto16 (int a, char c[]) { // a为要转换的十进制数 将结果存放在数组c中 ,以数组形式输出   int y;   int k = 0;   do {     y = a % 16;     a = a / 16;     for (int i = 0; i <= 9; i++) {       if (y == i) { ...

2018-11-14 22:09:00 2500

转载 一篇文章有若干行,以空行作为输入结束的条件。统计一篇文章中单词the(不管大小写,单词the是由空格隔开的)的个数。...

#include <iostream>using namespace std;int k = 0;int n = 0;int main() {   char c;     char a[1000];   do   {     cin.get(c);    if(c>='A'&&c<='Z'){ //将大写转换为小写      c=c...

2018-11-14 21:27:00 639

转载 统计字符串中的单词数

int numwords(char a [] ){  int i ,j ,num = 0 ;  for ( i = 0 , j = strlen (a) ; i<j;){ //遍历a字符串    while(a[i] == ' ') i++ ; //遇到空格时 跳过    if(i<j) num++; //跳过空格 i<j 计数+1    while...

2018-11-14 09:53:00 181

转载 向函数中传输二维数组

void xxx(int **a, int r . int c){  // r代表行 , c代表列  //在转变后的函数中,array[i][j]这样的式子是不对的,因为编译器不能正确的为它寻址,所以我们需要模仿编译器的行为把array[i][j]这样的式子手工转变为 ((int ...

2018-11-14 08:46:00 181

转载 查验身份证 (15 分) 一个合法的身份证号码由17位地区、日期编号和顺序编号加1位校验码组成。校验码的计算规则如下: 首先对前17位数字加权求和,权重分配为:{7,9,10,5,8,4,2,1,6...

// test4.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。// #include "pch.h"#include <iostream>#include <cmath>using namespace std;int quanz[17] = { 7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2 };char...

2018-11-08 00:17:00 9407

转载 统计一行文本的单词个数 (15 分) 本题目要求编写程序统计一行字符中单词的个数。所谓“单词”是指连续不含空格的字符串,各单词之间用空格分隔,空格数可以是多个。 输入格式: 输入给出一行字符。 输...

MD,一开始就想着怎么 用空格和结尾前判断字母 来计算写的头的爆了, 反过来判断空格后面是否有 =‘ ’就尼玛容易多了#include<stdio.h>#include<stdlib.h>#include<string.h>int main(){int i,j=0,sign=0;char str[10000];...

2018-11-07 14:03:00 11279

转载 3、习题5.14 编写一个程序,输人一个十进制数,输出相应的二进制数。设计一个递归函数实现数制转换。...

这代码写的真的是越写越冗长无力吐槽#include <iostream>using namespace std;void tran_dayu0_b_hex(int x)//转换函数1 { if (x > 0) { static int a[1000]; static int cal = 0;//用于store、计数 int yushu; ...

2018-11-04 22:51:00 2697

转载 实验:输入一篇英文新闻,以“#”结束,统计其中a-z这26个字母各出现的次数和总字符个数。(不区分大小写)...

  代码如下:#include <iostream>using namespace std;int main() {char ch;char s_letter[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w',...

2018-10-24 21:41:00 1793

转载 c++ count函数

count函数algorithm头文件(#include <algorithm>)定义了一个count的函数,其功能类似于find。这个函数使用一对迭代器和一个值做参数,返回这个值出现次数的统计结果。编写程序读取一系列int型数据,并将它们存储到vector对象中,然后统计某个指定的值出现了多少次。核心代码:cout<<count(ivec.begi...

2018-10-24 21:32:00 526

转载 C++简单输入输出-计算火车运行时间

//写的很差,无力tc7-4计算火车运行时间(17 分)本题要求根据火车的出发时间和达到时间,编写程序计算整个旅途所用的时间。输入格式:输入在一行中给出2个4位正整数,其间以空格分隔,分别表示火车的出发时间和到达时间。每个时间的格式为2位小时数(00-23)和2位分钟数(00-59),假设出发和到达在同一天内。输出格式:在一行输出该旅途所用的...

2018-10-10 13:14:00 1972

转载 C++ 保留有效小数 保留有效数字

1.需要头文件#include <iomanip>2.要保留两位有效小数cout<<setiosflags(ios::fixed)<<setprecision(2)<<然后再输出实数类型变量即可以保留2位小数输出了,当然你要保留三位小数,setprecision(3)就行。setprecision是指设置...

2018-09-23 10:46:00 1088

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除