现在位置: 首页 > Mpeazyni发表的所有文章
  • 07月
  • 23日
综合 ⁄ 共 164字 评论关闭
1:需求:   1:不定类型的数组,可能是int类型,可能是char类型等等   2:求数组中元素个数   3:编译器和系统类型不知道   4:假设数组是type  array[max] 2:解决:   1:函数sizeof:返回一个对象或者类型所占的内存字节数。   2:元素个数为sizeof(array)/sizeof(array[0])
阅读全文
  • 05月
  • 27日
综合 ⁄ 共 4597字 评论关闭
(1)class 与 object的联系 singleton objects - scala中没有静态方法和属性,全部由singleton object(单例对象)来替代如果没有相对应的class,而是只有一个object的话,则称为stand-alone. object。在object中定义的内容如果为public,则对外开放,而相对的在class中定义的内容则必须在class被实例化是才可以被调用,另一方面的佐证:class可以定义构造参数,而相对的object则无法定义构造 (2)Trait Trait有点类似于java中的interface,但也有不同之处: ①java的interface只定义方法名称和参数列表,不能定义方法体。而trai......
阅读全文
  • 02月
  • 15日
综合 ⁄ 共 2623字 评论关闭
B. Fox And Jumping time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at the cell 0. There are also n cards, each card has 2 attributes: length li and cost ci. If she pays ci dollars then she can apply i-th card. After applying i-th card she becomes able t......
阅读全文
  • 01月
  • 07日
综合 ⁄ 共 2760字 评论关闭
A. Free cash 题目大意,输入第一行输入n,然后输入n行,每行输入两个数h 和 m ,要求把出现次数最多的h和m的次数输出。思路:此题运用哈希法,先令一个数tmp = h * 100 + m ,然后建立一个数组vis[2505],因为h <= 24 , m <= 60 ,所以tmp < 2505 ,最后用vis[tmp] ++ 来统计次数,找出vis数组中的最大值即可。 以下是代码: #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<string> #include<cmath> #include<cstdlib> #include<queu......
阅读全文
gethostbyname_r、gethostbyaddr_r #include<unistd.h> #include<netdb.h> int main() { struct hostent hostbuf,*res = NULL; char buf[8192] = {0}; int err = 0; //gethostbyname_r("www.baidu.com",&hostbuf,buf,sizeof(buf),&res,&err); in_addr_t addr = inet_addr("127.0.0.1"); gethostbyaddr_r((char*)&addr,4,AF_INET,&hostbuf,buf,sizeof(buf),&res,&err); printf("h_name:%s\n",res->h_name); return 0; }
阅读全文
  • 07月
  • 01日
综合 ⁄ 共 2436字 评论关闭
每个Oracle用户都有一个名字和口令,并拥有一些由其创建的表、视图和其他资源。Oracle角色(role)就是一组权限(privilege)(或者是每个用户根据其状态和条件所需的访问类型)。用户可以给角色授予或赋予指定的权限,然后将角色赋给相应的用户。一个用户也可以直接给其他用户授权。     数据库系统权限(Database System Privilege)允许用户执行特定的命令集。例如,CREATE TABLE权限允许用户创建表,GRANT ANY PRIVILEGE 权限允许用户授予任何系统权限。     数据库对象权限(Database Object Privilege)使得用户能够对各个对象......
阅读全文
文章目录   4.1 Dispose()的使用   4.2 using的使用   4.3 事件的卸载   4.4 API的调用   4.5继承 IDisposable实现自己内存释放接口 http://blog.csdn.net/yuanhuiqiao/article/details/5264480 摘要   本文主要讨论了,什么是.Net内存泄露?如何确定是发生了内存泄露?如何预防内存泄露的发生? 正文   1.dot Net内存泄露简介    可能很多.Net的用户(甚至包括一些dot Net开发者)对Net的内存泄露不是很了解,甚至会说.Net不存在内存泄露,因为“不是有GC机制吗?”--......
阅读全文
  • 04月
  • 24日
综合 ⁄ 共 3176字 评论关闭
一个神奇的函数,转载来学习学习 /***************************************************** ** Name : sscanf.c ** Author : gzshun ** Version : 1.0 ** Date : 2011-12 ** Description : sscanf function ******************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> static void sscanf_test(void); static void sscanf_test(void) { int ret; char *string; int digit; char buf1[255]; char buf2[255]; ......
阅读全文
  • 03月
  • 22日
综合 ⁄ 共 251字 评论关闭
FileStream fs = new FileStream (filename,FileMode.Open);             StreamReader sr = new StreamReader (fs);             int total=0;             while (sr.Peek()>0) {                 sr.ReadLine();                 total++;             }             fs.Close();
阅读全文
  • 03月
  • 16日
综合 ⁄ 共 7534字 评论关闭
网上介绍Boost signal原理的文章很多,这里不介绍原理,仅贴一些示例代码,这在初步接触Boost signal时能够有个较好的感性认识,深入了解需要去体会挖掘boost源码。代码基本上来自Boost turioal,其中有一些错误会导致编译不过,这里都做了更正: 1. 基本运用 #include <boost/signals2.hpp> #include <boost/bind.hpp> #include <iostream> using namespace std; using namespace boost; struct HelloWorld { void operator()() const { std::cout << "Hello, World!" << std::endl; } }......
阅读全文
  • 02月
  • 22日
综合 ⁄ 共 2031字 评论关闭
题目描述 已知线性表 LA 和 LB 中的数据元素按值非递减有序排列,现要求将 LA 和 LB 归并为一个新的线性表 LC, 且 LC 中的数据元素仍然按值非递减有序排列。例如,设LA=(3,5,8,11) ,LB=(2,6,8,9,11,15,20) 则 LC=(2,3,6,6,8,8,9,11,11,15,20) 算法描述如下: 从上述问题要求可知,LC中的数据元素或是LA中的数据元素,或是LB中的数据元素,则只要先设LC为空表,然后将LA或LB中的元素逐个插入到LC中即可。为使LC中元素按值非递减有序排列,可设两个指针 i 和 j 分别指向LA和LB中某个元素,若设 i 当前所指的元素为 a,j 所指......
阅读全文
  • 12月
  • 14日
综合 ⁄ 共 2042字 评论关闭
#include <graphics.h> #include <conio.h> #include <math.h> // 定义全局变量 int rosesize = 500; int h = -250; // 定义结构体 struct DOT {double x;double y;double z;double r; // 红色double g; // 绿色// b(蓝色) 通过 r 计算 }; // 计算点 bool calc(double a, double b, double c, DOT &d) {double j, n, o, w, z; if(c > 60) // 花柄{d.x = sin(a * 7) * (13 + 5 / (0.2 + pow(b * 4, 4))) - sin(b) * 50;d.y = b * rosesize + 50;d.z = 625 + cos(a * 7) * (13 + 5 / (0.2 + pow(b *......
阅读全文