文件名称:normaldistribution
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:809byte
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <fstream>
#include <iostream>
using namespace std
struct Code
{
float a
char s
}
Code cc[8]={{0.25, a },{0.3, b },{0.1, c },{0.05, d },{0.05, e },{0.05, . },{0.05, , },{0.15, 8 }}
int main()
{
srand((unsigned)time(NULL))
int x
int n
ofstream outobj("plpl.txt")
cout<<"inpute the number(要产生的字符数):"
cin>>n
for(int i=0 i<n i++)
{
x=rand()%1000+1
int low =1
for(int j=0 j<8 j++)
{
int high=cc[j].a*1000+low-1
if(x>=low&&x<=high)
{
outobj<<cc[j].s
break
}
low = high+1
}
}
outobj.flush()
outobj.close()
} 存到.dat文件里面-# Include <stdlib.h># Include <stdio.h># Include <time.h># Include <fstream># Include <iostream> using namespace std struct Code (float a char s) Code cc [ 8] = ((0.25, a), (0.3, b), (0.1, c), (0.05, d), (0.05, e), (0.05,.), (0.05,,), (0.15, 8 )) int main () (srand ((unsigned) time (NULL)) int x int n ofstream outobj ( plpl.txt ) cout << inpute the number (to generate the number of characters): cin>> n for (int i = 0 i <n i++) (x = rand () 1000+ 1 int low = 1 for (int j = 0 j <8 j++) (int high = cc [j] . a* 1000+ low-1 if (x> = low
#include <stdio.h>
#include <time.h>
#include <fstream>
#include <iostream>
using namespace std
struct Code
{
float a
char s
}
Code cc[8]={{0.25, a },{0.3, b },{0.1, c },{0.05, d },{0.05, e },{0.05, . },{0.05, , },{0.15, 8 }}
int main()
{
srand((unsigned)time(NULL))
int x
int n
ofstream outobj("plpl.txt")
cout<<"inpute the number(要产生的字符数):"
cin>>n
for(int i=0 i<n i++)
{
x=rand()%1000+1
int low =1
for(int j=0 j<8 j++)
{
int high=cc[j].a*1000+low-1
if(x>=low&&x<=high)
{
outobj<<cc[j].s
break
}
low = high+1
}
}
outobj.flush()
outobj.close()
} 存到.dat文件里面-# Include <stdlib.h># Include <stdio.h># Include <time.h># Include <fstream># Include <iostream> using namespace std struct Code (float a char s) Code cc [ 8] = ((0.25, a), (0.3, b), (0.1, c), (0.05, d), (0.05, e), (0.05,.), (0.05,,), (0.15, 8 )) int main () (srand ((unsigned) time (NULL)) int x int n ofstream outobj ( plpl.txt ) cout << inpute the number (to generate the number of characters): cin>> n for (int i = 0 i <n i++) (x = rand () 1000+ 1 int low = 1 for (int j = 0 j <8 j++) (int high = cc [j] . a* 1000+ low-1 if (x> = low
(系统自动生成,下载前可以参看下载内容)
下载文件列表
normaldistribution.txt
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.