![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c和c++
aiting23
且行且珍惜
展开
-
C语言如何动态申请空间(一维和二维)
C语言如何动态申请一维和二维空间呢? 这里有个小例子,看过后就很容易理解 编译环境为vs2013原创 2016-12-14 17:11:49 · 1653 阅读 · 0 评论 -
如何随机生成01随机字符串
在c或c++中,随机生成01随机字符串 编译环境为vs2013#include <iostream>using namespace std;int main(){ char key[64]; for (int i = 0; i<64; i++){ key[i] = (char)(rand() % 2 + '0'); //rand()随机生成数字然原创 2016-12-10 18:19:31 · 2298 阅读 · 0 评论 -
c语言如何生成随机数
如何产生随机数c语言 编译环境vs2013,代码如下#include<stdio.h>#include<stdlib.h>#include<time.h>int main(){ int num = 0; srand(time(NULL)); //系统时间作为随机种子 num = rand(); //rand()函数产生随机数 printf("生成的原创 2016-12-16 19:49:18 · 2596 阅读 · 1 评论 -
c++如何生成随机数
c++如何生成随机数 编译环境vs2013#include<iostream>#include<time.h>using namespace std;int main(){ int num = 0; srand(time(NULL)); num = rand(); cout << "生成的随机数为" << num << endl; system("pa原创 2016-12-16 19:41:22 · 537 阅读 · 1 评论 -
C语言如何生成规定范围内的随机数
如何生成规定范围内的随机数c语言/c++ 编译环境vs2013#include<stdio.h>#include<time.h>#include<stdlib.h>#define max 100 //随机生成最大的数为100#define min 50 //随机生成最小的数为50int main(){ int num; srand(time(0)); n原创 2016-12-16 20:47:49 · 24331 阅读 · 2 评论