转载自:求一个数转换为二进制中1的个数// Count1--01.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include using namespace std;int coutn1(int num){ int result = 0; whil...
分类:
其他好文 时间:
2015-05-11 16:06:24
阅读次数:
138
数组T中的每个值都是指针,指针指向node结点,node结点中的元素为key,data。
代码:
#include
#include
typedef struct Node
{
int key;
int data;
}Node;
typedef struct T
{
Node **table;//利用指针数组
int size;
}T;
void T_creat...
分类:
其他好文 时间:
2015-05-11 16:06:14
阅读次数:
168
一直觉得jni文档太少了,#include 后,看着函数名大概能猜出函数意思来,但心里一直不放心,搜索来去也没有找到详细靠谱的文档。直到现在,发现了!“The Java(TM) Native Interface–Programmer’s Guide and Specification”一书中,在其JNI Functions章节中详细讲解了jni.h中的各函数含义及详情,总算解了一心节。...
分类:
编程语言 时间:
2015-05-11 14:57:07
阅读次数:
164
#include
void init(int arr[],int len)
{
int i = 0;
for (i = 0; i < len; i++)
{
arr[i] = len - i;
}
}
void show(int *parr, int len)
{
int i = 0;
for (i = 0; i < len; i++)
{
printf("%d ",...
分类:
编程语言 时间:
2015-05-11 14:50:30
阅读次数:
135
分析:筛法的思想,首先记录每个值的坐标,在使用筛法。
#include
using namespace std;
int a[10005];
int f[10005];
int main()
{
int i,n,j,mx,ans,tmp;
ios::sync_with_stdio(false);
while(cin>>n)
{
mx=-1;
memset(f,-1,size...
分类:
其他好文 时间:
2015-05-11 14:49:13
阅读次数:
145
// 自己的strncpy与库里的strncpy区别
#include
#define CHAR char
#define ULONG unsigned long
CHAR *VOS_strncpy(CHAR *pcDest, const CHAR *szSrc, ULONG ulLength)
{
CHAR *pcPoint = pcDest;
// 对指针进行判空
if ((NU...
分类:
编程语言 时间:
2015-05-11 14:48:35
阅读次数:
163
#include
int nk(int n,int k)
{
if (k == 0)
return 1;
else
return n * nk(n, k - 1);
}
int main()
{
int ret = nk(3,4);
printf("%d\n", ret);
return 0;
}
测试用例为3的4次方,结果是81。
例子较简单,是对递归的简单练习,...
分类:
其他好文 时间:
2015-05-11 14:46:23
阅读次数:
99
#include"clock.h"CLOCK::CLOCK(QWidget*parent):QWidget(parent){QTimer*timer=new QTimer(this);timer->start(1000);//一秒钟connect(timer,SIGNAL(timeout()),th...
分类:
其他好文 时间:
2015-05-11 14:43:51
阅读次数:
193
本次上课继续讲解了 [ ] 、-> 等运算符重载的具体例子也讲解了C++单个参数的类的类型转换的案例最后稍微提到了 static 的第三种作用:静态数据成员具体详解我都已注释出来了,大家可以慢慢看有任何问题都可以在这篇文章下留言我会及时解答 :)#include #include using nam...
分类:
编程语言 时间:
2015-05-11 14:37:56
阅读次数:
118
我的错误代码: 1 #include 2 3 using namespace std; 4 5 int longestValidParentheses(string s) 6 { 7 int i = 0; 8 int L = s.length(); 9 int j;10 ...
分类:
其他好文 时间:
2015-05-11 12:54:52
阅读次数:
96