- 博客(25)
- 资源 (1)
- 收藏
- 关注
转载 C语言实现将字符串“askdaskaskdaskg”删除制定字符“ask”
//将字符串“askdaskaskdaskg”删除制定字符“ask”,删除后的结果是“ddg” #include#include#includeint main(){char res[20],*p,*sub="ask",*str="askdaskaskdaskg",*str2;int i=0;printf(" Str:%s\n\n",str);p=su
2015-09-06 11:25:59
789
转载 C语言实现回文判断(利用指针的方法)
//判断回文(指针实现)#include #include #include void IsSymmetrical(char *str) { char *begin, *end; int flag, len = strlen(str); for (begin=str, end=str+len-1
2015-09-06 11:06:46
8653
1
转载 C语言实现字符串转化成整数
//字符串数转化成整数#include#includeint main(void){int num=12345,j=0,i=0,sum=0;char temp[7] = {'1','2','3','4','5','\0'},str[7];while(temp[i]){sum = sum * 10 + (temp[i]-'0'); //字符串数减‘0’
2015-09-06 09:26:08
1067
转载 C语言实现将整数转化成字符串数,不用函数itoa
//将整数转化成字符串数,不用函数itoa#include#includeint main(void){int num=12345,j=0,i=0;char temp[7],str[7];while(num){temp[i] = num%10+'0'; //整数加‘0’,隐性转化成char类型的数i++;num = num/10;}
2015-09-06 09:12:18
1619
转载 C语言实现快速排序
//快速排序#includetypedef int ElemType;int Partition(ElemType A[], int left, int right){ElemType pivot = A[left];while(left {while(left=pivot)--right;A[left] = A[right];while(left
2015-09-04 15:25:35
409
转载 C语言实现冒泡排序
//冒泡排序#includevoid BubbleSort(int A[], int len){int n = len;int i,j,temp;for(i=0; i{bool flag = false;for(j=n-1; j>i; j--){if(A[j-1] > A[j]){temp = A[j-1];A[j-1] = A[j];
2015-09-04 15:03:22
610
原创 mysql模糊查找:一个表T2的某列数据,作为另一个表T1查找条件进行模糊查找
mysql模糊查找:一个表T2的某列数据,作为另一个表T1查找条件进行模糊查找语法格式:SELECT 查找字段1,查找字段2,... FROM T1,T2 WHERE T1.用来查找的列名 LIKE CONCAT('%',T2.用来作为模糊查找条件的列名,'%')实例:SELECT ID,`Start`,`End`,Address FROM ipfinddb,nat
2015-07-28 11:01:15
5518
原创 将button的click事件作为判断条件
问题:C#编程,将button的click事件作为判断条件解决方法:定义bool类型的全局变量flag将值设为false;然后将button的click事件,添加代码,flag的设为true;然后以flag作为if判断条件。(注意:要将方法设为public类型)部分代码实现: bool flag = false; public vo
2015-07-22 20:11:57
10241
2
转载 c语言实现二叉树层次遍历(借助队列实现)
//c语言实现二叉树层次遍历(借助队列实现)#include #include //二叉链表类型定义typedef struct btnode{char data;struct btnode *lchild,*rchild;}bitree,*Bitree;//链队列类型定义typedef struct LinkQueueNode{bit
2015-07-10 16:17:44
19200
4
转载 C语言实现二叉树的递归遍历和非递归遍历
//递归实现二叉树的遍历#include#include#define STACKINITSIZE 100#define STACKINCREASESIZE 20typedef char ElemType;//树结构typedef struct tree{ElemType data;struct tree * lchild;str
2015-07-10 10:45:12
1328
转载 malloc ,realloc,calloc区分
三个函数的申明分别是: void* malloc(unsigned size); void* realloc(void* ptr, unsigned newsize); void* calloc(size_t numElements, size_t sizeOfElement); 都在stdlib.h函数库内,它们的返回值都是请
2015-07-10 09:41:30
502
转载 python实现1、使用迭代器实现斐波那契数列;2、从迭代器得到序列
#python使用迭代器实现斐波那契数列>>> class Fibs:def __init__(self):self.a = 0self.b = 1def next(self):self.a,self.b = self.b,self.a+self.breturn self.adef __iter__(self):return self>>> fibs = F
2015-07-09 16:32:32
2008
转载 Python为什么要self
Python为什么要self 15 March 2011 20:25 Tuesday by 小屋标签: 关键字 Python self接触Python以来,看到类里的函数要带个self参数,一直搞不懂啥麻子原因。晚上特别针对Python的self查了一下,理理。Python要self的理由Python的类的方法和普通的函数有一个很明显的区别,在类的方法必
2015-07-09 15:02:40
519
转载 C语言实现顺序栈的括号匹配
//顺序栈的使用举例:括号的匹配#include #include #define OK 1#define ERROR 0#define TRUE 1#define FALSE 0#define STACK_INIT_SIZE 100#define STACKINCREMENT 10#define BUFFERSIZE 256
2015-07-08 21:48:46
6932
转载 python循环判断异常(异常处理)
#循环只有在没有异常的情况下才会退出while True: try: x = input('Enter the first number:') y = input('Enter the second number:') value = x/y print 'x/y is ', value except
2015-07-08 16:34:01
9389
转载 python捕捉对象(异常处理)
#捕捉对象:让程序继续运行,但是又因为某种原因记录下错误给用户看try:x = input('Enter the first number:')y = input('Enter the second number:')print x/yexcept (ZeroDivisionError,TypeError,NameError),e:print e运行结果:注
2015-07-08 16:17:48
812
转载 C语言实现循环队列基本操作(初始化、判断队空、入队、出队)
//循环队列的基本操作#include#define MaxSize 50typedef int ElemType;//定义循环队列结构体typedef struct {ElemType data[MaxSize];int front,rear;}SqQueue;//初始化void InitQueue(SqQueue &Q){Q.
2015-07-07 21:48:00
26016
2
转载 C语言实现顺序栈的基本操作(初始化、判断空、入栈、出栈、获取栈顶元素)
//顺序栈的基本操作#include#define MaxSize 50typedef int ElemType;//定义栈结构体typedef struct{ElemType data[MaxSize];int top;}SqStack;//初始化栈void InitStack(SqStack &S){S.top = -1;}
2015-07-07 17:31:05
33247
5
转载 C语言实现双链表基本操作(创建、查找、插入、删除)
//双链表基本操作#include#includetypedef int ElemType;typedef struct DNode{ElemType data;struct DNode *prior,*next;}DNode,*DLinkList;//尾插法建立链表DLinkList CreatDList(DLinkList &la){
2015-07-07 10:11:31
1367
转载 C语言实现单链表相关操作
//单链表相关操作#include#includetypedef int ElemType; typedef struct LNode{ElemType data;struct LNode *next;}LNode,*LinkList;/*//头插法建立链表LinkList CreatList1(LinkList &la){
2015-07-07 07:52:44
512
转载 C语言顺序表的插入、删除、查找操作实现
//顺序表的插入、删除、查找操作实现#include#include#define InitSize 10#define MaxSize 50//#define bool int//#define true 1//#define false 0typedef int ElemType;typedef struct{ElemType *data;
2015-07-04 21:42:08
9598
转载 python向网页提交数据
源代码:以https://www.crowdfunder.com/deals网站为例(该网页并非使用异步加载方法)#-*-coding:utf8-*-import requestsimport re#url = 'https://www.crowdfunder.com/deals'#html = requests.get(url).text#print html.encode("g
2015-06-28 10:41:00
3010
原创 C语言实现:1、实现文本文件内数据格式的统一;2、实现文本文件导入MySQL数据库。
/*2015年5月15日:1、实现文本文件内数据格式的统一;2、实现文本文件导入MySQL数据库。(站在巨人的肩膀上学习,成长,感谢前辈们!!)*/#include #include #include #include #include "mysql.h" /*连接MySQL数据库的头文件*/ #pragma comment(lib,"libmysql")
2015-05-15 19:16:53
1214
转载 C语言访问MySQL数据库
从网上得到的一个已有程序,经过简单修改和调试满足了自己变成的需求,记录一下。。。谢谢前辈们的分享,让我们可以站在巨人的肩膀上学习,进步!!#include#include#include#include#include "mysql.h" #pragma comment(lib,"libmysql")#define HOST "localhost"#defi
2015-05-15 18:45:23
438
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人