-
Find prime numbers prepared by screening the function: void sieve (bool isPrime...
编写筛选查找素数函数:
void sieve(bool isPrime[], int n)
其中isPrime[ ]为一个布尔型数组,n为数组大小。由于2是第一个素数,
所以设置isPrime[0]和isPrime[1]的值为false,并设置其余的元素初值为true。
然后对从4到n-1的每一个i,判断i是否能够被2整除,如果i能够被2整除,则设置isPrime[i]为false。
对从2到n/2的每一个可能的数值重复以上处理,当操作结束时,所有值为true的isPrime[i]所对应的i就是素数,它们将是从筛子中掉下来的。-Find prime numbers prepared by screening the function: void sieve (bool isPrime [], int n) which isPrime [] as a Boolean array, n is the size of the array. Because 2 is the first prime number, so set the isPrime [0], and isPrime [1] a value of false, and set the initial value of the remaining elements of true. And then from 4 to n-1 for each i, to determine whether i can be divisible by 2, if i can be divisible by 2, then set the isPrime [i] is false. From 2 to n/2 possible values for each one to repeat the above processing, when the operation ended, all the true value of the isPrime [i] corresponding to i is a prime number, they will be falling from the sieve in the past.
- 2023-03-02 04:45:03下载
- 积分:1
-
提供一个遗传算法C++类
提供一个遗传算法C++类-provide a genetic algorithm C
- 2022-04-10 15:22:31下载
- 积分:1
-
/*这个程序是学数据结构后写的,里面涉及到了栈和队列的一些操作。开始本来只是要做迷宫求解的,但就看着电脑在里面运行,没有互动性也没什么意思,于是加入了由人控制的...
/*这个程序是学数据结构后写的,里面涉及到了栈和队列的一些操作。开始本来只是要做迷宫求解的,但就看着电脑在里面运行,没有互动性也没什么意思,于是加入了由人控制的角色,让电脑控制的角色每走一步都计算一次当前两者的最短距离去追赶人控制的角色。这个程序画地图的部分是得于网上的一个迷宫程序,汉字部分也是用的别别人写好的子程序。其实这个程序还不是很完善,开始做好了一个,却不知那儿弄丢了,假期因为参加电子设计大赛,都玩单片机去了,这方面的也忘差不多了,希望有兴趣的朋友能改好了发给我.我的email:xiangyuan_122@163.com*/-err
- 2022-05-17 02:55:02下载
- 积分:1
-
用 VB.net实现的打字练习源程序代码
用 VB.net实现的打字练习源程序代码-Realize using VB.net source code typing practice
- 2023-07-11 21:10:02下载
- 积分:1
-
桩基工程中质量检测各种不同缺陷的波形变换,包括常见的缩颈扩颈断桩等...
桩基工程中质量检测各种不同缺陷的波形变换,包括常见的缩颈扩颈断桩等-Foundation Engineering quality inspection of various defects waveform conversion, including common Neck expanding carotid broken pile etc.
- 2022-08-02 17:19:59下载
- 积分:1
-
这是一个可以画出马尔萨斯引力线图的源程序.可以在vc环境下运行....
这是一个可以画出马尔萨斯引力线图的源程序.可以在vc环境下运行.-it to be a paint Malthus gravity map of the source. Vc can run under.
- 2023-05-28 00:35:03下载
- 积分:1
-
对ZBTSRAM接口的详细介绍
对学习ZBTSRAM接口的设计有一定帮助
对ZBTSRAM接口的详细介绍
对学习ZBTSRAM接口的设计有一定帮助-ZBTSRAM interface for a detailed introduction to learning ZBTSRAM interface design has a certain extent, help
- 2022-06-27 19:22:13下载
- 积分:1
-
编译Billiards.dsw文件,在Debug目录下会生成Billiards.exe文件,直接双击该文件,即可运行“网络台球”程序。 ************...
编译Billiards.dsw文件,在Debug目录下会生成Billiards.exe文件,直接双击该文件,即可运行“网络台球”程序。 ****************** Billiards在运行时需要glut32.dll的支持,另外还需要资源文件BILLIARDSTABLE.bmp、MOHOGANY.bmp和tableface.bmp。-compiler Billiards.dsw documents in the Debug directory will generate Billiards.exe document, double-click the file directly, and can run "cyber billiards" procedures.****************** Billiards at runtime glut32.dll need the support of other documents also need resources BILLIARDSTABLE.bmp, MOHOGANY.bmp and tableface.bmp.
- 2022-11-23 05:55:03下载
- 积分:1
-
很有用的一份图纸资料
如果各位有类似资料麻烦也上传上来哈...
很有用的一份图纸资料
如果各位有类似资料麻烦也上传上来哈-Useful information on a drawing if you have similar trouble also upload information onto Kazakhstan
- 2022-03-04 02:55:58下载
- 积分:1
-
myself prepared by the String class, can achieve some simple functions, such as...
我自己编写的字符串类,可以实现一些简单的功能,如赋值、加法、字符串比较、下边运算符重载等!-myself prepared by the String class, can achieve some simple functions, such as assignment, Ghaffar, string comparison, Now, as Operator!
- 2022-01-28 14:24:46下载
- 积分:1