自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 常量指针 指针常量

【代码】常量指针 指针常量。

2023-05-02 15:10:35 116

原创 用fork创建子进程

【代码】用fork创建子进程。

2023-04-28 15:39:12 182

原创 制作一个5GB的空洞文件

【代码】制作一个5GB的空洞文件。

2023-04-28 15:37:35 161

原创 重定向输出 把hello输出到文件

【代码】重定向输出 把hello输出到文件。

2023-04-28 15:35:29 182

原创 通过系统调用IO实现文件拷贝

【代码】通过系统调用IO实现文件拷贝。

2023-04-28 15:27:34 156

原创 通过ftell获取文件长度

【代码】通过ftell获取文件长度。

2023-04-28 15:26:20 218

原创 通过标准IO实现文件拷贝

【代码】通过标准IO实现文件拷贝。

2023-04-28 15:24:41 203

原创 统计某个字符在文件中出现的次数

【代码】统计某个字符在文件中出现的次数。

2023-04-28 15:21:48 155

原创 通过标准库IO,统计文件中有多少字符

【代码】通过标准库IO,统计文件中有多少字符。

2023-04-28 15:19:49 65

原创 多进程实现的质数查询

【代码】多进程实现的质数查询。

2023-04-27 16:55:20 93

原创 打乱数组顺序

#include <stdio.h>#include <stdlib.h>#include <time.h>#define ARRAY_SIZE 50int ElementSwitch(int a[], int first, int second){ int tmp; tmp = a[first]; a[first] = a[second]; a[second] = tmp; return 0;}int Shuffle(int a[].

2021-09-24 13:03:24 338 1

原创 C 基本线程

#include <stdio.h>#include "tinycthread.h"int SayHello(char *name){ printf("Run in new thread [%#x]: Hello, %s\n", thrd_current(), name); return 0;}int main(void){ thrd_t new_thread; int result = thrd_create(&new_thread, SayHello, .

2021-09-23 17:55:43 88

原创 N的阶乘,递归

#include <stdio.h>unsigned Factorial(unsigned n){ if(n == 0){ return 1; } else{ return n * Factorial(n - 1); }}int main(void){ printf("3! %d\n", Factorial(3)); printf("5! %d\n", Factorial(5)); printf("8! %d\n", Factorial(8)).

2021-09-23 15:12:44 148

原创 C语言 变长参数

#include <stdio.h>#include <stdarg.h>void HandleVarargs(int arg_count, ...){ //定义 va_list用于获取变长参数 va_list args; //开始便利 va_start(args, arg_count); for (int i = 0; i < arg_count; ++i) { //取出对应参数 int arg = va_arg(args, int).

2021-09-23 14:42:29 69

原创 控制器双活 负载均衡

所谓的传统存储双控双活,我的目前的理解是这样,首先,目的是啥?有两个1、部件冗余,也就是高可用(HA)2、负载均衡双控的HA模式有三种,1、HA:也就是A-P模式,在某一时刻只有一个控制器处理上层下来的业务,另一个控制器闲置,只有在活动控制器出现故障的时候,才切换到这个闲置的控制器,这种方式由于太过于土豪,等于花了两样的钱,只能使一样,所以基本没人用这种方式了。2、

2018-01-27 23:18:32 5228

原创 show_ip.sh

#!/bin/bash##ip_addr=$(ifconfig | grep "inet addr" | grep -v "127" | awk '{print $2}'| awk -F ':' '{print $2}')echo "your ip address is ${ip_addr}"your ip address is 172.16.54.207

2015-12-11 13:23:27 524

原创 mytrans.sh

#!/bin/bash##echo "the first para is $1"echo "the second para is $2"echo "the third para is $3"echo "the number of para is $#"echo "the para are $*"echo "the PID is $$"echo "the last PID is $

2015-12-11 11:31:11 424

原创 mygrep

#!/bin/bash##grep $1 /etc/passwd

2015-12-11 11:09:13 454

原创 where are you

#!/bin/bash##echo "you are in the `pwd`"

2015-12-10 16:10:12 403

原创 hello

#!/bin/bash##function say_hello(){ echo "Enter your name:" read name echo "Hello ${name}"}echo "Programme start here......"say_helloecho "Programme Ends."

2015-12-10 16:01:43 250

原创 清理/var/log/messages的脚本

#!/bin/bash#this is clearcat /dev/null > /var/log/messagesecho "message clear up"

2015-12-10 15:21:46 2303

原创 列出场景中所有对象

/* 列出场景中所有对象 显示名称和类型 */proc listAll(){    print("\nNodes...");    //定义一个数组nodes,执行ls命令,把结果存入数组    string $nodes[] = `ls`;    //执行for循环:如果node在nodes中,则对node执行 objectType命令,并把结果存储在变量nodeType中

2014-04-01 10:13:44 721

原创 一个简单的类 和 调用

#include using namespace std;class Time{public: //构造函数 Time(); //设置时间函数 void setTime(int, int, int); //24小时制显示时间 void showTime24(); //12小时制显示时间 void showTime12();private: int hour; int

2014-03-21 12:51:32 506

原创 简单的函数模版

#include using namespace std;template T volume(T side1, T side2, T side3){ return side1 * side2 * side3;}int main(){ cout << volume(1, 2, 3) << endl; cout << volume(1.2, 2.0, 3.3) << endl;

2014-03-20 11:32:19 506

原创 function overload 2

#include #include using namespace std;int square(int);double square(double);int main(){ cout << square(8) << endl; cout << square(9.3) << endl; return 0;}int square(int edge){

2014-03-19 23:25:12 756

原创 function overload

#include #include using namespace std;int square(int);double square(double);int main(){ cout << square(8) << endl; cout << square(9.3) << endl; return 0;}int square(int edge){

2014-03-19 23:17:57 682

原创 一个c++小程序

#include int mycube(int);using namespace std;int main(){ int side; cout << "enter the cube side: " << endl; cin >> side; cout << "the volume of the cube is: " << mycube(side) <<

2014-03-18 21:29:17 606

原创 (三)顺序栈main函数

#include "seqstack.h"int main(){ SeqStack stack; initSeqStack(&stack); printf("%d\n", isEmptySeqStack(stack)); PushSeqStack(&stack, 111); PushSeqStack(&stack,

2014-03-18 21:05:46 3048 2

原创 (二)顺序栈函数定义

#include "seqstack.h"int initSeqStack(SeqStack* S){ S->top = 0; return 0;}int clearSeqStack(SeqStack* S){ for (int i=0; itop; i++) S->data[i] = 0; S->top = 0; return 0

2014-03-18 21:04:53 836

原创 (一)顺序栈头文件

#include #include #define STACKMAXSIZE 10typedef struct seqstack{ int data[STACKMAXSIZE]; int top;}SeqStack;int initSeqStack(SeqStack*);int destroySeqStack(SeqStack*);int clearS

2014-03-18 21:03:46 1631

原创 一个斐波那契数列

#include #define FIBONSIZE 20int main(){ int a = 0, b = 1, c, fibon[FIBONSIZE]; for (int i = 0; i < FIBONSIZE; i++){ c = a + b; fibon[i] = c; a = b; b = c; } for (int i = 0; i < FIBONS

2014-03-18 09:31:55 501

原创 (三)链表main函数

#include "linklist.h"int main(){ linklistPtr head; create_linklist(&head); printf("%d\n", head->data); insert_linklist(&head); traversal_linklist(head); del_linklis

2014-03-15 23:44:20 2487

原创 (二)链表头文件

#include #include //define a link node structtypedef struct linklistnode{ int data; struct linklistnode *next;}linklist, *linklistPtr;//declaration create_linklistint create_linklist(l

2014-03-15 23:43:22 907

原创 (一)链表函数定义文件

#include "linklist.h"int create_linklist(linklistPtr* L){ if(!((*L) = (linklistPtr)malloc(sizeof(linklist)))) return 1; (*L)->data = 234; (*L)->next =NULL; return 0; }

2014-03-15 23:41:55 638

原创 (三)线性表菜单

#include "seqlist.h"int main(){ //定义一个线性表变量 SqList sqlist; int choose, position, value; do{ printf("************ seqlist menu ************\n"); printf("\t1 创建顺序表\n"); printf("\t2 判断顺序表是否为空

2014-03-14 17:27:34 946

原创 (二)函数定义文件

#include "seqlist.h"//1 创建一个顺序表int create_SqList(SqListPtr L){ for (int i = 0; i < LISTMAXSIZE; i++) L->data[i] = 0; L->length = 0; return 0;}//2 判断顺序表是否为空int isEmpty_SqList(SqList L){ re

2014-03-14 17:26:50 707

原创 (一)线性表头文件

#include #include #ifndef LISTMAXSIZE#define LISTMAXSIZE 10#endif//定义一个顺序表typedef struct SqList{ int data[LISTMAXSIZE]; int length;}SqList, *SqListPtr;//1 创建一个顺序表int create_SqList(SqList

2014-03-14 17:25:55 7068

原创 二叉树的建立 与 遍历

#include #include //定义一个树节点的结构struct treeNode{ char data; struct treeNode *lchild, *rchlid;};//创建树的各个节点int create_tree(struct treeNode**);//遍历二叉树int show_tree(struct treeNode*);int main(

2014-03-13 15:13:31 624

原创 初始化一棵树

#include #include //定义一个树节点的结构struct treeNode{ char data; struct treeNode *lchild, *rchlid;};//初始化一棵树的根节点int initial_tree(struct treeNode**);int main(){ //定义一个指向树节点的指针,并初始化为空 struct tre

2014-03-13 12:39:02 3530 1

原创 顺序栈的一般操作

#include //define the size of array#define MAXSIZE 100//define new data type: stackstruct stack{ int data[MAXSIZE]; int top;};//defint var seqStacktypedef struct stack seqStack;//crea

2014-03-11 22:28:51 497

空空如也

空空如也

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

TA关注的人

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