- 博客(11)
- 资源 (1)
- 收藏
- 关注
原创 note--基本语法(1)
1.作用域问题string text = ""; //这里必需初始化for (int i = 0; i text = "hello text" + i;}Console.WriteLine(text);2. switch case 必须加break3. int[][] array //锯齿数据 与 int[,] array 区别 int[][
2015-05-09 09:05:53
837
转载 Visimulator for Notepad++
ViSimulator for notepad++Description:ViSimulator for notepad++ is a plug-in for notepad++, which makes it possible to edit as vi/vim in notepad++. ViSimulator simulates/emulates most frequen
2015-03-28 16:51:51
3307
原创 c语言实现不同类型数组的print(union + flag)
#include #include #include union ArrayType { int *d; double *lf; char *c;};enum DATATYPE { CHAR = 'c', DOUBLE = 'l', INT = 'd'};struct ArrayType2 { enum DATATYPE flag; union { int *d; double *lf; char
2014-12-07 18:58:50
945
原创 c语言重载不同类型数组的print(c99标准)
#include #define printX(x, n) _Generic((x), \ double *: print_double, \ int *: print_int)(x, n)void print_double(double arr[], int n){ for (int i = 0; i < n; ++i) printf("double %lf\n", arr[i]);}void
2014-12-07 18:54:31
993
原创 求整数二进制表示中1的个数,三种算法
void bitcount(int x){ printf("%d ",x); int i = 0; while(x) { x &= x-1; i++; } printf("%d\n",i);}void bitcount2(int x){ printf("%d ",x); int i = 0; while(x) {
2014-10-21 17:28:50
583
转载 R中利用apply、tapply、lapply、sapply、mapply、table等函数进行分组统计
原文链接apply函数(对一个数组按行或者按列进行计算):使用格式为:apply(X, MARGIN, FUN, ...)其中X为一个数组;MARGIN为一个向量(表示要将函数FUN应用到X的行还是列),若为1表示取行,为2表示取列,为c(1,2)表示行、列都计算。示例代码:> ma > ma [,1] [,2] [,3] [,4][1,]
2014-01-16 18:14:33
1856
原创 SQL删除部分字段重复
delete t1 from futures t1where exists( select 1 from futures t2 where t1.Code = t2.Code and t1.date = t2.date and t1.volume<t2.volume group by Code,date)--在 table futures中,删除字段code、date相同
2014-01-16 18:08:01
718
转载 内存对齐和sizeof(结构体)
有的时候,在脑海中停顿了很久的“显而易见”的东西,其实根本上就是错误的。就拿下面的问题来看:sizeof(T)的值为多少呢?structT{char ch;int i ;};在32位机中,int是4个字节,char是1个字节,所以T一共是5个字节。实践出真知,在VC6中测试了下,答案确实8个字节。为什么答案和自己想象的有出入呢?这里将引入内存对齐这个概念。许
2012-05-10 14:10:06
503
原创 pair类型 map
#include #include #include #include using namespace std;int main(){ pair exch ; typedef pair p; string first = "hello",last = "world",last2 = "new world"; exch = make_pair(firs
2012-04-23 16:34:37
582
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人