上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 48 下一页
摘要: C_C++_XY_03. 求两个数之间的素数 题目描述: 题目描述:给2个数,求这两个数字之间的素数个数,并将素数的个数返回,将求出的素数输出至pOut中。 对于如下函数即求[pInput[0], pInput[1]]之间的素数,将得到的素数输出至pOut中,返回素数的个数。 认为只能够被1和它本身整除的数字是素数。 要求实现函数: int vDecode(int* pInput, i... 阅读全文
posted @ 2013-07-15 23:01 helloweworld 阅读(664) 评论(0) 推荐(0) 编辑
摘要: 123456789101112131415161718192021 intmain() { int num = 7; int stopNum = sqrt(num); if (num stopNum) { cout << "素数" << endl; } return 0;} 为什么是sqrt(num)终止呢,因为一个合数可以是若干个质数的乘积,而且这若干个质数中至少有一个质数不... 阅读全文
posted @ 2013-07-15 22:46 helloweworld 阅读(314) 评论(0) 推荐(0) 编辑
摘要: 使用位域的主要目的是压缩存储,其大致规则为: 1) 如果相邻位域字段的类型相同,且其位宽之和小于类型的sizeof大小,则后面的字段将紧邻前一个字段存储,直到不能容纳为止; 2) 如果相邻位域字段的类型相同,但其位宽之和大于类型的sizeof大小,则后面的字段将从新的存储单元开始,其偏移量为其类型大小的整数倍; 3) 如果相邻的位域字段的类型不同,则各编译器的具体实现有差异,VC6采取不压缩方式,... 阅读全文
posted @ 2013-07-08 11:02 helloweworld 阅读(552) 评论(0) 推荐(0) 编辑
摘要: 位域的定义 struct data { unsigned short flaga:1; unsigned short flagb:3; char flagc:5; }; 1、1/3/5指的是二进制位数,即比特数,而不是字节数。 2、位域的类型只能是整型或字符型。如下面是不正确的 struct data{ unsigned short flaga :1; unsigned short fla... 阅读全文
posted @ 2013-07-08 10:26 helloweworld 阅读(287) 评论(0) 推荐(0) 编辑
摘要: 冒泡排序每次从头开始(每次结束可以不到最后,因为上一次已经确定最大值在末尾了),比较相邻两个数,每次下沉一个最大值。123456789101112131415161718192021222324252627282930313233343536#includeusingnamespace std;voidbubbleSort(int a[], int length){ bool swapFlag; for (int i = 1; i a[j+1]) { swapFlag = true; swap(a[j], a[j+1]); } } if (swapFlag == false) { break. 阅读全文
posted @ 2013-07-07 16:13 helloweworld 阅读(225) 评论(0) 推荐(0) 编辑
摘要: //============================================================================// Name : 希尔排序.cpp// Author : Lucas// Version :// Copyright : http://www.cnblogs.com/vestinfo/// Descrip... 阅读全文
posted @ 2013-07-06 13:27 helloweworld 阅读(198) 评论(0) 推荐(0) 编辑
摘要: #includeusingnamespacestd;classTest{public: intstra; staticintsta;//静态数据成员并不会介入对象内存布局。 intstrb; intstrc;};intTest::sta=1;intmain(){ inta; intb; intc; Tests; cout *freeList; private: float y; static co... 阅读全文
posted @ 2013-07-05 17:20 helloweworld 阅读(434) 评论(0) 推荐(0) 编辑
摘要: 一、在192.168.0.30主机上搭建BT服务器(windows操作系统)。 下载BitCometTracker软件,点击run即可。 参考http://www.cnblogs.com/rupeng/archive/2010/06/19/1761070.html 二、在网关做nat映射。 1234567 iptables -t nat -A PREROUTING --dst ... 阅读全文
posted @ 2013-06-24 19:03 helloweworld 阅读(738) 评论(0) 推荐(0) 编辑
摘要: 一、ubuntu安装BT tracker软件。 1、安装软件。 sudo apt-get install python (提供BT运行环境,Bittorrent是用Python语言编写) sudo apt-get install apache ssh bittorrent 2、启动服务。 sudo service apache2 start sudo bttrack --port 6969 --... 阅读全文
posted @ 2013-06-24 18:58 helloweworld 阅读(448) 评论(0) 推荐(0) 编辑
摘要: (1) 安装dhcp3-server:apt-get install dhcp3-server (2) a、gedit /etc/default/dhcp3-server INTERFACES="eth1" b、gedit /etc/dhcp3/dhcpd.conf subnet 192.168.0.0 netmask 255.255.255.0 { range 192.168.0.2 192... 阅读全文
posted @ 2013-06-24 14:49 helloweworld 阅读(140) 评论(0) 推荐(0) 编辑
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 48 下一页