
C
文章平均质量分 86
久许
朋友拍了拍我,说我可不是什么幺蛾子
展开
-
autoconf使用记录
目录acat@acat-xx:src$ tree.├── aclocal.m4├── AUTHORS├── autom4te.cache│ ├── output.0│ ├── output.1│ ├── requests│ ├── traces.0│ └── traces.1├── autoscan.log├── bson│ ├── APACHE-2.0.txt│ ├── GNU-AGPL-3.0.txt│ ├── lib│ │ ├── a...原创 2021-04-15 19:26:26 · 302 阅读 · 0 评论 -
Training: Crypto - Caesar II (Crypto, Training)
I guess you are done with Caesar I, aren't you?The big problem with caesar is that it does not allow digits or other characters.I have fixed this, and now I can use any ascii character in the plaintext.The keyspace has increased from 26 to 128 too. \o/原创 2020-08-05 22:28:15 · 537 阅读 · 0 评论 -
Prime Factory (Training, Math)
Your task is simple:Find the first two primes above 1 million, whose separate digit sums are also prime.As example take 23, which is a prime whose digit sum, 5, is also prime.The solution is the concatination of the two numbers,Example: If the first nu原创 2020-08-05 20:30:53 · 317 阅读 · 0 评论 -
Training: Crypto - Transposition I (Crypto, Training)
输入一个字符串:oWdnreuf.lYuocnaraedhteemssgaeawyebttrewehnhteelttresraenicroertcodrre.Ihtnikoyuowludilektoeseoyrupsawsrodon:wbhpcsbpigsd.l然后把这个字符串中的字符按照每两个为一组的方式进行字符的交换。#include<stdio.h>int main(){ char a[1000] = {0}; ...原创 2020-08-05 20:35:49 · 173 阅读 · 0 评论 -
C语言实现输入ascii码,输出对应的字符
源代码/********** ascii.c ************/#include<stdio.h>#include<string.h>char strs[1000]= "0,NUL,16,DLE,32, ,48,0,64,@,80,P,96,`,112,p,1,SOH,17,DC1,33,!,49,1,65,A,81,Q,97,a,113,q,2,STX,18,DC2,34,\",50,2,66,B,82,R,98,b,114,r,3,ETX,19,DC3,3原创 2020-07-02 17:19:12 · 27079 阅读 · 3 评论 -
C++贪吃蛇
food.h/********** food.h ************/#include<iostream>using namespace std;#include "wall.h"class Food{public: Food(Wall& wall); //设置食物 void setFood();private: int foodX; int foodY; Wall& wall;};food.cpp/**********原创 2020-06-28 14:42:06 · 676 阅读 · 0 评论 -
STL案例1
1 /********** ab.cpp ************/ 2 #include<iostream> 3 #include<vector> 4 #include<map> 5 #include<algorithm> 6 #include<deque> 7 #include<numeric> 8 using namespace std; 9 10 class Speaker 11 { 12 public: 13 ...原创 2020-06-26 20:58:18 · 584 阅读 · 0 评论 -
核心转储文件的设置和查看
设置转储文件名在/proc/sys/kernel/core_pattern文件中写入内容,%e表示可执行程序名,%t表示时间。默认的情况下生成的core文件名是core。这样如何和别的进程产生的core文件名重合的话,就会被替代。设置转储文件大小因为默认的转储文件大小是0,所以不会生成转储文件。为了能够生成转储文件,需要设置一下转储文件的大小。测试编写主函数/*******************************************************************原创 2020-06-20 10:00:58 · 2919 阅读 · 0 评论 -
makefile的编写步骤
makefile的好处:一次编写,终身受益makefile的命名规则:makefileMakefilemakefile的三要素目标依赖规则命令这三个要素当中,目标不可以不写,其余的两个要素可以不写。写法目标:依赖tab键 规则命令第一版makefile缺点:如果只更改其中一个文件,所有的源码都重新编译可以考虑编译过程分解,把.c的文件变为.o的文件。先生成.o文件,然后使用.o文件得到结果。各个文件的以来关系图如下据此,对makefile文件进行更新原创 2020-06-19 23:00:21 · 872 阅读 · 0 评论 -
使用gcc制作静态库和共享库
在linux中,静态库以.a结尾,动态库以.so结尾。在windows中,静态库以.lib结尾,动态库以.dll结尾库文件的作用是什么?如果只想把功能提供给别人,而不想别人看到源代码,那么就需要把源代码制作成库文件提供给对方。只需要使用头文件,然后调用函数接口静态库的文件名:libxxx.a —> windows的 .lib文件。制作步骤:两步①把.c的文件变成.o的文件②对这些.o文件打包在一起。(ar rcs libmycalc.a file1.o file2.o file3.o原创 2020-06-19 21:02:01 · 575 阅读 · 0 评论 -
主板芯片组和内存映射
内存管理是操作系统的核心。这对于编程和系统管理都至关重要。在接下来的几篇文章中,我将着眼于实际问题来涵盖内存,但不会回避内部问题。尽管这些概念是通用的,但示例大多来自32位x86上的Linux和Windows。第一篇文章介绍了程序在内存中的布局方式。多任务操作系统中的每个进程都在其自己的内存沙箱中运行。此沙箱是虚拟地址空间,在32位模式下,它始终是4GB的内存地址块。这些虚拟地址通过页表映射到物理内存,这些页表由操作系统内核维护并由处理器查询。每个进程都有自己的一组页表,但是有一个陷阱。启翻译 2020-06-18 14:02:06 · 3481 阅读 · 0 评论 -
C++中对operator=进行重写
/************************************************************************* > File Name: copy1.cpp > Author: > Mail: > Created Time: 2020年06月17日 星期三 15时36分57秒 ************************************************************************/#inc原创 2020-06-17 20:32:44 · 1766 阅读 · 0 评论 -
Special members in C++
Default constructor默认构造函数是在声明类的对象但未使用任何参数初始化时调用的构造函数。如果类定义没有构造函数,则编译器会假定该类具有隐式定义的默认构造函数。因此,在声明这样的类之后:编译器假定Example具有默认构造函数。因此,可以通过简单地声明它们而无需任何参数来构造此类的对象:但是,只要一个类的某个构造函数接受了显式声明的任意数量的参数,编译器便不再提供隐式默认构造函数,并且不再允许该类的新对象不带参数的声明。例如,以下类:在这里,我们声明了一个带有int类型参翻译 2020-06-17 17:57:35 · 189 阅读 · 0 评论 -
在C++中把operator==定义为类的成员函数
Duree.h#ifndef _DUREE_H#define _DUREE_Hclass Duree{ public: Duree(int heures = 0,int minutes = 0,int secondes = 0); bool estEgal(Duree const &b)const; bool operator==(Duree const& other);//如果把operator==作为类的成员函数,那么只需要一个参数就够了原创 2020-06-16 09:22:10 · 1383 阅读 · 0 评论 -
C++判断是否存在某个文件
#include<iostream>using namespace std;bool FileExists(const string &filename) { if (FILE * file = fopen(filename.c_str(), "r")) { fclose(file); return true; } return false;}int main(){ cout << FileExis.原创 2020-06-15 21:24:47 · 468 阅读 · 0 评论 -
C++中讲字符串转换为大写和小写的字符串
/************************************************************************* > File Name: ToUL.cpp > Author: > Mail: > Created Time: 2020年06月15日 星期一 20时21分59秒 ************************************************************************/#incl原创 2020-06-15 20:28:58 · 310 阅读 · 0 评论 -
使用C++获取当前系统的时间(年-月-日 时:分:秒)
/************************************************************************* > File Name: mytime.cpp > Author: > Mail: > Created Time: 2020年06月15日 星期一 16时56分31秒 ************************************************************************/#in原创 2020-06-15 17:09:32 · 1129 阅读 · 0 评论 -
在c++中使用ofstream、ifstream和fstream完成文件的读写
1.使用ofsrtream和ifstream/* File Handling with C++ using ifstream & ofstream class object*//* To write the Content in File*//* Then to read the content of file*/#include <iostream> /* fstream header file for ifstream, ofstream, fstream classe原创 2020-06-15 16:16:29 · 409 阅读 · 0 评论 -
在C++中引入头文件小demo
Log.h/************************************************************************* > File Name: Log.h > Author: > Mail: > Created Time: 2020年06月15日 星期一 09时55分06秒 ************************************************************************/#i原创 2020-06-15 15:14:29 · 757 阅读 · 0 评论 -
int class::function() const{}
该函数不能更改类的成员变量/************************************************************************* > File Name: b.cpp > Author: > Mail: > Created Time: 2020年05月20日 星期三 17时11分54秒 *********************************************************************原创 2020-05-20 17:39:25 · 229 阅读 · 0 评论 -
map,pair小探索
/************************************************************************* > File Name: mmap.cpp > Author: > Mail: > Created Time: 2020年05月20日 星期三 07时30分51秒 ************************************************************************/#incl原创 2020-05-20 08:37:12 · 271 阅读 · 0 评论 -
c语言学习
#include<stdio.h>int main(){#ifdef ABC printf("----------------------%s---------------\n",__FILE__);#endif printf("hello,world!\n"); return 0;}/*编译: gcc -DABC -o 001 001.c运行输出:------...原创 2019-12-07 22:37:43 · 386 阅读 · 0 评论 -
判断大端方式还是小端方式
高位优先(大端方式)的体系结构把最高字节位放在最小的内存地址上。这和低位优先形成了鲜明的对照下面这段代码在用户空间和内核空间都可以使用。#include<stdio.h>int main(){ int x = 1; if(*(char *) &x == 1) printf("低位优先(小端方式)"); else printf("高位优先(大端方式)")...原创 2019-07-27 22:49:45 · 842 阅读 · 0 评论 -
关于C语言中数组和指针的理解
代码:#include<stdio.h>#include<malloc.h>unsigned int get2byte(unsigned char *data){ return (data[0] << 8) | data[1];}int main(){ unsigned char *data; data = (unsigned char *)...原创 2019-06-27 08:39:27 · 539 阅读 · 0 评论