求高手帮忙看段c++程序

[复制链接]
查看11 | 回复5 | 2009-4-30 10:59:56 | 显示全部楼层 |阅读模式
ifstream InfRand;
InfRand.open("rand.txt");
int nSearchWidth = 101;
for(int i = 0; i > dNljRand[j];
InfRand.close();
这个程序里面rand.txt是一段产生-0.5到0.5的2000个随机数
这个rand.txt怎么编?

回复

使用道具 举报

千问 | 2009-4-30 10:59:56 | 显示全部楼层
#include #include #include #include #include using namespace std;int main(){ fstream InfRand("rand.txt", ios::out); if(!InfRand) {cerr << "cannot open file! " << endl;return -1; }int nSearchWidth = 101;double dNljRand[101][20]; int i, j; sran...
回复

使用道具 举报

千问 | 2009-4-30 10:59:56 | 显示全部楼层
编个程序写进文件。随机数,好像是用srand((unsigned)time(NULL));rand();...
回复

使用道具 举报

千问 | 2009-4-30 10:59:56 | 显示全部楼层
写一个程序创建呗...
回复

使用道具 举报

千问 | 2009-4-30 10:59:56 | 显示全部楼层
精确到小数点后几位呢?...
回复

使用道具 举报

千问 | 2009-4-30 10:59:56 | 显示全部楼层
你得先确定精度...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行