资源简介
C++实现的单纯形法计算程序,输入变量规模自动生成问题然后解出来

代码片段和文件信息
#ifndef _IOSTREAM_
#include
#endif
#ifndef _IOMANIP_
#include
#endif
#include
#include
using namespace std;
#include“matrix.h“
#define MAX 10
#define MIN 0.001
int main(){
int ij;
int mn;
timeb t1t2;
srand(time(0));
cout<<“Num. of the Variables:“;
cin>>m;
cin.get();
n = 2 * m;
cout<<“m=“< double **matrix = new double * [m+1];
for (i = 0 ; i < m ; i ++)
{
matrix[i] = new double[n+1];
for (j = 0 ; j < n + 1 ; j ++ )
{
if( j < m )
matrix[i][j] = double(MAX * rand() / (RAND_MAX+1));
else if( j == n )
matrix[i][j] = MIN + double( (MAX-MIN) * rand() / (RAND_MAX+1));
else if(j == m + i)
matrix[i][j] = 1;
else
matrix[i][j] = 0;
}
}
matrix[m] = new double[n+1];
for (int j = 0 ; j < n+1 ; j ++ )
{
matrix[m][j] = (j < m )?double(0 - (rand() % MAX)):0.0;
}
cout.precision(6);
cout.setf(ios_base::leftios_base::adjustfield);
if(m<50)
{
for (i = 0 ; i < m + 1 ; i ++)
{
for (j = 0 ; j < n + 1 ; j ++ )
{
cout< }
cout< }
}
Matrix Solver(matrixmn);
bool isSolved= true;
ftime(&t1);
try
{
Solver.solve();
}catch(int)
{
isSolved = false;
}
ftime(&t2);
cout<<“Takes “<<(1000*t2.time+t2.millitm)-(1000*t1.time+t1.millitm)<<“ ms to solve“<
if(m<50)
{
if(isSolved)
Solver.PrintAns();
else
;
}
cout<<“Press any key to continue...“< cin.get();
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1566 2011-12-10 12:59 src\main.cpp
文件 3238 2011-12-10 12:14 src\matrix.cpp
文件 603 2011-12-10 10:44 src\matrix.h
目录 0 2006-01-01 04:13 src
----------- --------- ---------- ----- ----
5407 4
- 上一篇:AES加密算法(C++实现)
- 下一篇:网络流量统计源程序c++
相关资源
- 国际象棋的qt源代码
- C++中头文件与源文件的作用详解
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- C++纯文字DOS超小RPG游戏
- VC++MFC小游戏实例教程(实例)+MFC类库
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- c++素数筛选法
- C++ mqtt 用法
- 商品库存管理系统 C++ MFC
- c++ 多功能计算器
- C++17 In Detail
- 嵌入式QtC++编程课件
- 颜色识别形状识别STM103嵌入式代码
- c++ 邮件多附件群发
- c++ 透明代理(hookproxy)
- mfc 调用redis
- FTP客户端源码(c++)
- c++ 画图(14Qt-XPS)
- c++多边形交并差运算
评论
共有 条评论