自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 LINUX UBOOT bootdelay设置为0解决办法

在common文件夹中有main.c 把bootdelay_process(); 注释,之后就可以直接进配置环境。

2022-01-09 21:25:28 1435

原创 Python 语法元素

Python 3.x 保留字列表 (33个) and elif import raise as else in return assert except is try break finally lambda while class for nonlocal with continue from

2017-09-06 20:43:52 391

原创 C/C++ | 31-29 求1000!的未尾有几个0(用素数相乘的方法来做,如72=2*2*2*3*3)

求1000!的未尾有几个0(用素数相乘的方法来做,如72=2*2*2*3*3); 求出1->1000里,能被5整除的数的个数n1,能被25整除的数的个数n2,能被125整除的数的个数n3, 能被625整除的数的个数n4. 1000!末尾的零的个数=n1+n2+n3+n4; #include #define NUM 1000 using namespace std; in

2017-07-28 12:10:39 577

原创 C/C++ | 31-28 函数比较两个字符串str1和str2的大小

/* 写一个函数比较两个字符串str1和str2的大小,若相等返回0, 若str1大于str2返回1,若str1小于str2返回-1 */ #include #include #include using namespace std; int strmp(char *s1, char *s2) { while (*s1 == *s2) { if (*s1 == '

2017-07-28 12:09:10 2204

原创 C/C++ | 30-27 给定字符串A和B,输出A和B中的最大公共子串

给定字符串A和B,输出A和B中的最大公共子串。 比如A="aocdfe" B="pmcdfa" 则输出"cdf" #include #include #include using namespace std; char *strcmp(char *s1,char *s2,char *dest) { char*scmp2=s2; int count = 0, t

2017-07-28 12:08:16 2461

原创 C/C++ | 30-26 函数在给定的内存区域搜索给定的字符,返回索引值

请编写一个 C 函数,该函数在给定的内存区域搜索给定的字符,并返回该字符所在位置索引值 int search(char *s, char ch, int n) { int i; int m = strlen(s); for (i = 0; i<n && *(s + i) != ch; ++i); if ( i>=m) { cout << "No find tar

2017-07-28 12:07:22 1435

原创 C/C++ | 30-25 在一个字符串中找到可能的最长的子字符串

编写一个 C 函数,该函数在一个字符串中找到可能的最长的子字符串,且该字符串是由同一字符组成的。 #include #include #include #include #include #include #include #include #include using namespace std; void FindMaxLong(char *s,ch

2017-07-28 12:05:28 1449 1

原创 C/C++ | 30-24 两个字符串,s,t;把t字符串插入到s字符串中,s字符串有足够的空间存放t字符串

void insert(char *s, char *t, int i) { memcpy(&s[strlen(t)+i],&s[i],strlen(s)-i); memcpy(&s[i],t,strlen(t)); s[strlen(s)+strlen(t)]=’\0′; }

2017-07-28 12:03:51 994

原创 C/C++ | 29-21 两个字符串,s,t;把t字符串插入到s字符串中,s字符串有足够的空间存放t字符串

/* ======================================================== c和指针(《pointers on c》) 8.1.11 一个字符串,如"hello",一般为字符串常量,可以用它对字符指针赋值, 或初始化,相当于把这个字符串常量的首地址赋给这个指针,如: char *p = "hello"; 或者 char *p; p="hello"; 但是

2017-07-28 12:01:55 1971 1

原创 C/C++ | 28-20 写出程序删除链表中的所有节点

/* 删除所有链表的节点 */ #include #include #include #include #include #include #include #include #include using namespace std; typedef struct LNode { int data; struct LNode *next; }LNode; LNode

2017-07-27 18:43:12 1557

原创 C/C++ | 27-19 写出程序把一个链表中的接点顺序倒排

#include #include #include #include #include #include #include #include #include using namespace std; typedef struct LNode { int data; struct LNode *next; }LNode; LNode *CreateLink(int

2017-07-27 18:41:46 799

原创 C/C++ | 27-18 n的无序数组,求排序算法,并且要求时间复杂度为O(n)

/* 写出程序把一个链表中的节点顺序倒排 */ #include #include #include #include #include #include #include #include #include using namespace std; typedef struct LNode { int data; struct LNode *next; }LN

2017-07-27 18:40:15 340

原创 C/C++ | 26-17 已知一个单向链表的头,删除其某一个结点的算法

/* 已知一个单向链表的头,请写出删除其某一个结点的算法, 要求,先找到此结点,然后删除。 */ #include #include #include #include #include #include #include #include #include using namespace std; typedef struct LNo

2017-07-27 18:35:23 2793 2

原创 C/C++ | 25-16 实现子串定位int FindSubStr

实现子串定位int FindSubStr(const char *MainStr, const char *SubStr) #include #include #include #include #include #include #include #include #include using namespace std; int FindSubStr(c

2017-07-27 18:34:11 552

原创 C/C++ | 25-15 实现strcmp,int StrCmp(const char *str1, const char *str2)

实现strcmp,int StrCmp(const char *str1, constchar *str2) 若str1==str2,则返回零; 若str1,则返回负数; 若str1>str2,则返回正数。 #include #include #include #include #include #include #include #include #i

2017-07-27 18:32:19 2077

原创 C/C++ | 24-14 间隔删数组,求最后一个被删掉的数的原始下标位置

有一个数组a[1000]存放0--1000;要求每隔二个数删掉一个数,到末尾时循环至开头继续进行,求最后一个被删掉的数的原始下标位置。 /* 有一个数组a[1000]存放0--1000;要求每隔二个数删掉一个数,到末 尾时循环至开头继续进行,求最后一个被删掉的数的原始下标位置。 */ #include #include #include #include #include

2017-07-27 18:31:26 535

原创 C/C++ | 23-13 求此数列前20项的和

有一分数序列:1/2,1/4,1/6,1/8……,用函数调用的方法,求此数列前20项的和 #include #include #include #include #include #include #include #include #include using namespace std; double getval(int n) { double re

2017-07-27 18:30:00 1033

原创 C/C++ | 23-12 用指针的方法,将字符串“ABCD1234efgh”前后对调显示

/* 用指针的方法,将字符串“ABCD1234efgh”前后对调显示 */ #include #include #include #include #include using namespace std; int main() { char str[] = "ABCD1234efgh"; int length = strlen(str); char

2017-07-27 18:28:39 2778

原创 C/C++ | 22-11 栈求组合数

/* 求组合数: 求n个数(1….n)中k个数的组合…. 如:combination(5,3) 要求输出:543,542,541,532,531,521,432,431,421,321, #include #include #include #include #include #include #include #include #include using nam

2017-07-27 18:11:11 587

原创 C/C++ | 22-10 不用库函数,用C语言实现将一整型数字转化为字符串

/* 不用库函数,用C语言实现将一整型数字转化为字符串 */ #include #include #include #include #include using namespace std; char *inverse(int num,char *str2) { int i = 0; int str1[100]; while (num) //倒叙存放

2017-07-15 14:54:36 650

原创 C/C++ | 21-9 字符串中找出连续最长的数字串,并把这个串的长度返回

/* 写一个函数,它的原形是int continumax(char *outputstr,char *intputstr) 功能: 在字符串中找出连续最长的数字串,并把这个串的长度返回, 并把这个最长数字串付给其中一个函数参数outputstr 所指内存。 例如:"abcd12345ed125ss123456789"的首地址传给intputstr 后,函数将返回9, outputstr 所指的值为

2017-07-15 14:47:27 524

转载 C/C++ | 20-7链表,单链表的建立,把’a'–’z’26个字母插入,倒叙,打印

/* 构造链表,单连表的建立,把’a'–’z’26个字母插入到连表中,并且倒叙,还要打印! */ //#include //#include //#include //#include //#include // ////http://blog.csdn.net/s_scott/article/details/52701474 #include #include typed

2017-07-15 14:38:56 1468

原创 C/C++ | 20-6递归算法判断数组a[N]是否为一个递增数组

/* 用递归算法判断数组a[N]是否为一个递增数组。 */ #include #include #include #include #include using namespace std; bool fun(int a[],int n) { if (n == 1) return true; if (n == 2) return a[n - 1] >= a[

2017-07-15 14:35:17 1073

转载 C/C++ | 18-4 快排 Qsort

/* 快速排序, */ #include #include #include #include #include using namespace std; void Qsort(int a[], int low, int high) { if (low >= high) { return; } int first = low; int last = high;

2017-07-15 14:12:17 221

原创 C/C++ | 18-3 递归反向输出字符串

递规反向输出字符串的例子,可谓是反序的经典例程 /* 递规反向输出字符串 */ #include #include #include #include #include using namespace std; void inverse(char *p) { if (*p == '\0') return; else { inverse(p + 1); p

2017-07-05 10:32:59 1456

原创 C/C++ | 18-2 整数组合

/* 2、输出和为一个给定整数的所有组合 例如n=5 5=1+4;5=2+3(相加的数不能重复) 则输出 1,4;2,3。 */ 需要继续分解。待续 #include #include #include #include #include using namespace std; int main() { int a, b, c; cin >> a

2017-07-04 23:15:15 353

原创 C/C++ | 17-1 读取文件.txt

1、读文件file1.txt的内容(例如): 12 34 56 输出到file2.txt: 56 34 12 #include #include #include #include #include using namespace std; int MAX = 10; int main() { int *a=(int *)malloc(MA

2017-07-04 22:52:10 634

空空如也

空空如也

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

TA关注的人

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