rand()函数的讲解(转载)
摘要:C语言中的rand()函数rand()是真正的随机数生成器,而srand()会设置供rand()使用的随机数种子。如果你在第一次调用rand()之前没有调用srand(),那么系统会为你自动调用srand()。而使用同种子相同的数调用 srand()会导致相同的随机数序列被生成。srand((unsigned)time(NULL))则使用系统定时/计数器的值做为随机种子。每个种子对应一组根据算法预先生成的随机数,所以,在相同的平台环境下,不同时间产生的随机数会是不同的,相应的,若将srand(unsigned)time(NULL)改为srand(TP)(TP为任一常量),则无论何时运行、运行多
阅读全文
posted @
2013-04-29 09:17
@ 小浩
阅读(448)
推荐(0) 编辑
迷宫求解终结版(堆栈的使用)第三季
摘要:迷宫求解最后的终结版,哎呀,这老迷宫我终于完结了!!!话不多说,看程序吧!!!亲:#include<iostream>#include<stdio.h>#include<math.h>#include<string.h>#include<stdlib.h>#include<algorithm>#define LEN sizeof(struct Stack)#define INT_SIZE 1000#define INCREMENT 100using namespace std;int a[100][100];typedef
阅读全文
posted @
2013-04-28 21:05
@ 小浩
阅读(261)
推荐(0) 编辑
教务处管理系统(线性链表)
摘要:此程序是使用用线性链表写的,即用数组结构体写的!!!多的废话不说!!!看程序!!!!#include<stdio.h>#include<string.h>#include<iostream>#define MaxSize 100 using namespace std;/*学生信息结构体定义*/typedef struct{int stuno;char name[10];int score;int age;}Student;typedef struct{Student data[MaxSize];int length;}SqList;/*输入学生数据*/Sq
阅读全文
posted @
2013-04-27 10:01
@ 小浩
阅读(349)
推荐(0) 编辑
迷宫求解
摘要:栈的应用迷宫求解任务:可以输入一个任意大小的迷宫数据,用非递归的方法求出一条走出迷宫的路径,并将路径输出;源代码:#include<stdio.h>#include<stdlib.h>/*数据定义*/typedefenum { ERROR, OK } Status;typedefstruct{ int row; //row表示"行"号 int line; //line表示"列"号}PosType; //位置的元素类型typedefstruct{Int ord; //该通道在路径上的"序号"PosType sea
阅读全文
posted @
2013-04-21 23:05
@ 小浩
阅读(503)
推荐(0) 编辑
malloc realloc calloc
摘要:三个函数大多使用在c语言函数的指针当中为指针分配地址,他们的原型分别如下:void *realloc(void *ptr,unsigned newsize);void *malloc(unsigned size);void *calloc(num,unsigned size);他们包含在stdlib.h的函数里,一般使用sizeof()函数分配size的大小。1)malloc用于申请一段新的地址,size为所需空间的长度;例子如下:#include<stdio.h>#include<stdlib.h>int main(){char *num;num=(char *)ma
阅读全文
posted @
2013-04-20 00:11
@ 小浩
阅读(157)
推荐(0) 编辑
迷宫求解无敌版(递归调用结构体法)第二季
摘要:测试代码: 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 1 0 0 0 1 1 12 0 1 0 1 1 1 0 1 0 0 1 1 0 1 0-2 1 1 1 1 1 1 1 1 1 1代表障碍,0代表能通道,2代表起点,-2代表终点 本题我使用的是递归调用的方法解决的, 是一种深收的算法,呵呵!!!废话不多说,看哥的 精彩程序吧!!!程序输入情况如下:1代表障碍,2代表已经找到的通道,3代表起点和终点#include<iostream>#include<math.h>#include<stdio.h>#include<algor
阅读全文
posted @
2013-04-18 01:08
@ 小浩
阅读(262)
推荐(0) 编辑
jsp乱码问题解决方案
摘要:http://www.cnblogs.com/chengkai/articles/2171848.html<html><head><title>JSP的中文处理</title><meta http-equiv="Content-Type" content="text/html charset=gb2312"></head><body><%out.print("JSP的中文处理");%></body></html>这种
阅读全文
posted @
2013-04-16 13:55
@ 小浩
阅读(274)
推荐(0) 编辑
迷宫求解无敌版(递归调用法)
摘要:测试代码: 1 0 0 0 0 0 1 0 0 1 1 0 0 0 1 0 0 0 1 0 1 0 1 0 0 1-1 0 1 0 0 0 0 1 0 1 0 1 1 0 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 0-2 0 01代表障碍,0代表能走通,-1代表入口 2代表出口路径本题我使用的是递归调用的方法解决的,是一种深收的算法,呵呵!!!废话不多说,看哥的精彩程序吧!!!这里 0代表能走通,1代表障碍,2代表通道,3代表起始点和终止点#include<iostream>#include<stdio.h>#include<
阅读全文
posted @
2013-04-16 00:25
@ 小浩
阅读(528)
推荐(0) 编辑
afx.h
摘要:#include "stdafx.h"是预编译处理器把stdafx.h文件中的内容加载到程序中来。stdafx.h 1名称的英文全称为:Standard Application Fram Extend 所谓头文件预编译,就是把一个工程(Project)中使用的一些MFC标准头文件(如Windows.H、Afxwin.H)预先编译,以后该工程编译时,不再编译这部分头文件,仅仅使用预编译的结果。这样可以加快编译速度,节省时间。 预编译头文件通过编译stdafx.cpp生成,以工程名命名,由于预编译的头文件的后缀是“pch”,所以编译结果文件是projectname.pch。 编
阅读全文
posted @
2013-04-11 23:06
@ 小浩
阅读(855)
推荐(0) 编辑
vc++各种连接的处理方法
摘要:错误1:LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main在project-setting-link里找到project options 去掉里面的/subsystem:console错误2:nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endt...将工程设置为Using MFC in a static library错误3:libcmtd.lib(crt0.obj) : error LNK2001: unr
阅读全文
posted @
2013-04-11 21:47
@ 小浩
阅读(253)
推荐(0) 编辑
Tc3.0/Tc2.0使用方法
摘要:2007-09-02 15:35Turbo C 2.0/3.0(TC2.0/2.0)设置详解 对于初学程序设计的人来说Turbo C 2.0无疑是最简单最理想的入门语言环境之一,但也常由于环境变量设置的不正确导致程序无法编译运行,严重打击了初学者来之不易的自信心。为了迅速解决此类问题,使大家能把精力集中到程序设计上来,我们特地编写本文以帮助有心涉足编程领域的初学者。1.准备TC2.0 得到TC2.0的最简单快速的方法当然是从网上下载了 下载之后的工作就是解压缩了,解压缩可以使用WinZip或WinRar。在此我们假设将TC解压到"x:\TC20"目录(x表示盘符),当然您也
阅读全文
posted @
2013-04-11 18:48
@ 小浩
阅读(1884)
推荐(0) 编辑
表达式求值问题包括“+ - × / ( )"-->链表法
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h>#define error 0#define ok 1#define overflow -1#define STACK_INIT_SIZE 100#define STACKINCREMENT 10#define OPSETSIZE 7char OPSET[7]={'+','-','*','/','(',')','#'};unsigned
阅读全文
posted @
2013-04-09 22:48
@ 小浩
阅读(588)
推荐(0) 编辑
c语言中的atof函数
摘要:atof的作用是将字符数组转换成相应的双精度的实数,本题的例子如下:(仅供参考)#include<iostream>#include<stdlib.h>#include<string.h>using namespace std;int main(){char a[10]="1236241";double b=atof(a);cout<<b<<endl; return 0;}
阅读全文
posted @
2013-04-09 22:46
@ 小浩
阅读(2294)
推荐(0) 编辑
多项式四则混合运算(链表法)
摘要:#include<iostream>#include<stdio.h>#include<math.h>#include<string.h>#include<algorithm>#define LEN1 sizeof(struct Queue1)#define LEN2 sizeof(struct Queue2)#define LEN3 sizeof(struct Queue3)using namespace std;struct Queue1{double xishu;char zimu[10];double cishu[10];st
阅读全文
posted @
2013-04-02 13:38
@ 小浩
阅读(1054)
推荐(0) 编辑
一元一次多项式的加法运算(数组法)
摘要:#include<iostream>#include<string.h>#include<math.h>#include<algorithm>#include<stdio.h>using namespace std;int main(){double num1[20];double num2[20]; printf("请输入多项式的最高次数数\n"); int n; cin>>n; printf("请输入该一元多项式的元\n"); getchar(); char s; scanf(&
阅读全文
posted @
2013-04-02 13:35
@ 小浩
阅读(415)
推荐(0) 编辑
javascript如何提取字符串
摘要:JavaScript截取字符串方法详解1 substring() (1)用于提取字符串中介于两个指定下标之间的字符。语法:stringObject.substring(start,stop) start:必需。一个非负的整数,规定要提取的子串在第一个字符在 stringObject 中的位置。 stop;可选。一个非负的整数,比要提取的子串的最后一个字符在 stringObject 中的位置多 1。如果省 略该参数, 那么返回的子串会一直到字符串的结尾。(2)返回值一个新的字符串,该字符串值包含 stringObject 的一个子字符串,其内容是从 start 处到 stop-1 处的所有字.
阅读全文
posted @
2013-04-02 13:33
@ 小浩
阅读(1022)
推荐(0) 编辑