24小时热门版块排行榜    

查看: 547  |  回复: 2

zhaoyubosd

铜虫 (小有名气)

[求助] 求助C++编程,不胜感激

运行C++程序,显示运行成功,里面有这样一句话,请问是什么意思?The thread 0x2cb0 has exited with code 0 (0x0).如何解决。还有,黑色运行界面上为什么没有运行结果,请各位大神指教。附上程序代码。
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;

void fibermodel (double X[], int n0, double U[], int n1, double V[], int n2,
                                 double P[], int n3, double R[],int n4,
                                 double r, double l, double mu, double dp, double den,
                                 double converge, int n, double &dX);
int main ()
{       
//Hollow fiber

        double X[301],t[301], U[301], V[301], Pressure[301], R[301];
        double r, l, T,Rm, mu, dp, den, dX,converge,cp;
        double ResultP[51][51],ResultU[51][51],ResultV[51][51],ResultR[51][51];

        int n,m,IncrementT,IncrementX;
        string OutputFileName;

//Information about the software
        cout << "HOLLOW FIBER MEMBRANE SIMULATION SOFTWARE Version 1.0" << "\n"
                 << "developed by Dr. Lianfa Song, College of Engineering, Texas Tech University" << "\n"
                 << "APRIL 2015" << "\n" << "\n" << "\n";


// Open input file and read parameter values

        ifstream input_file("numeric.txt";
        input_file        >> r
                        >> l
                                >> T
                                >> Rm
                                >> mu  
                                >> dp
                                >> den
                                >> converge
                                >> n
                                >> m
                                >> IncrementX
                                >> IncrementT
                                >> cp
                                >> OutputFileName;
        cout << "The Name of Output File = " << OutputFileName << "\n" << "\n";

// Start calculation

// Call fibermodel
      
        int j,i;
        t[0]=0.0;
        for (j=1;j<=m;j++)
    {t[j]=t[j-1]+T/m;}

        for (j=0;j<=m;j++)
        {
            if (j=0)
        {
                   for(i=0;i<=n;i++)
                   { R=Rm;}
            }
                fibermodel (X, 301, U, 301, V, 301, Pressure, 301,
                                        R, 301, r, l, mu, dp, den, converge, n, dX);
        if (j%6==0)
        {
                   for(i=0;i<=n;i=i+6)
                          { ResultP[j]=Pressure;ResultU[j]=U;ResultV[j]=V;ResultR[j]=R;}
            }
        for(i=0;i<=n;i++)
                   { R=R+cp*V*T/m;}
        }
               
//Output results
// Open output file

        ofstream output_file(OutputFileName);
       
                output_file << "CONDITIONS" << "\n" ;
                output_file << fixed;
                output_file.precision(0);
                output_file  << setw(13) << "Space-Step="  << setw(13) << n << "\n";

                output_file << scientific;
                output_file.precision(4);
                output_file  << setw(13) << "InnerRadius="  << setw(13) << r << "\n";
                output_file  << setw(13) << "FiberLength="  << setw(13) << l << "\n";
                output_file  << setw(13) << "MemResisten="  << setw(13) << Rm << "\n";
                output_file  << setw(13) << "WaterViscos="  << setw(13) << mu << "\n";
                output_file  << setw(13) << "   Pressure="  << setw(13) << dp << "\n";
                output_file  << setw(13) << "ConvergeCre="  << setw(13) << converge << "\n" << "\n";
                output_file << fixed << "RESULTS1" << "\n";
//P的分布情况
                output_file << fixed << "Pressure" << "\n";

                output_file << scientific;
                output_file.precision(3);
                output_file<< "X";
                for (int j=0; j<=m; j=j+IncrementT)
                {output_file<< setw(13) << "t="<< t[j] << setw(13);}
                output_file<< endl;

        for (int i=0; i<=n; i=i+IncrementX)
                {   
                        output_file<< X ;
                        for (int j=0; j<=n; j=j+IncrementT)
                        {
                                output_file<< setw(13) << ResultP[j] << setw(13);
                        }
                        output_file<< endl;
            }
                output_file<< endl;
//u的分布情况
                output_file << fixed << "u" << "\n";

                output_file << scientific;
                output_file.precision(3);
                output_file<< "X";
                for (int j=0; j<=m; j=j+IncrementT)
                {output_file<< setw(13) << "t="<< t[j] << setw(13);}
                output_file<< endl;

        for (int i=0; i<=n; i=i+IncrementX)
                {   
                        output_file<< X ;
                        for (int j=0; j<=n; j=j+IncrementT)
                        {
                                output_file<< setw(13) << ResultU[j] << setw(13);
                        }
                        output_file<< endl;
            }
                output_file<< endl;

//v的分布情况
          output_file << fixed << "v" << "\n";

                output_file << scientific;
                output_file.precision(3);
                output_file<< "X";
                for (int j=0; j<=m; j=j+IncrementT)
                {output_file<< setw(13) << "t="<< t[j] << setw(13);}
                output_file<< endl;

        for (int i=0; i<=n; i=i+IncrementX)
                {   
                        output_file<< X ;
                        for (int j=0; j<=n; j=j+IncrementT)
                        {
                                output_file<< setw(13) << ResultV[j] << setw(13);
                        }
                        output_file<< endl;
            }
                output_file<< endl;

//R的分布情况
                output_file << fixed << "R" << "\n";

                output_file << scientific;
                output_file.precision(3);
                output_file<< "X";
                for (int j=0; j<=m; j=j+IncrementT)
                {output_file<< setw(13) << "t="<< t[j] << setw(13);}
                output_file<< endl;

        for (int i=0; i<=n; i=i+IncrementX)
                {   
                        output_file<< X ;
                        for (int j=0; j<=n; j=j+IncrementT)
                        {
                                output_file<< setw(13) << ResultR[j] << setw(13);
                        }
                        output_file<< endl;
            }
                output_file<< endl;
       
                system("PAUSE";
                return 0;
        }
// fibermodel defination

void fibermodel (double X[], int n0, double U[], int n1, double V[], int n2,
                                 double P[], int n3,double R[], int n4,
                                 double r, double l,  double mu, double dp, double den,
                                 double converge, int n, double &dX)
{
       
//Preparation

        double UP, LP, K, pi = 3.1415926;
        K=dX;
        dX = l/double(n);
        X[0]=0.0;
        for (int i=1; i<=n; i++)
                {X=X[i-1]+dX;}

//Start Calculation

        int iter=0;
        UP=dp;
        LP=0.0;
//
loop:        iter = iter +1;

        P[n] = 0.5*(UP+LP);
        U[n] =0.0;
        for (int i=n; i>=1; i--)
        {
                V = P/R;
                U[i-1] =U+2.0*dX*V/r;
                P[i-1]=P+8.0*mu*U[i-1]*dX/(r*r)+K*3.0*den*U[i-1]*V*dX/r;
                if (P[i-1] > dp)
                {UP=P[n]; goto loop;}
        }

                if (abs((P[0]-dp)/dp) > converge)
                {LP=P[n]; goto loop;}
        V[0] = dp/R[0];
               
        return;
        }
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zzy滴号

金虫 (小有名气)

代码太混乱了,都不能成功编译过去。数组与变量直接相等,不同大小的数组直接用=操作,还有10几个参数的函数。还是确认一下这是不是正确的代码吧。
天道酬勤
2楼2015-10-21 22:58:08
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

leetcoder

新虫 (初入文坛)

先说你这个程序用来干嘛→_→

发自小木虫Android客户端
3楼2015-10-22 09:14:39
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 zhaoyubosd 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 293求调剂 +3 涛涛Wjt 2026-03-22 5/250 2026-03-22 22:21 by jiangpengfei
[考研] 263求调剂 +4 yqdszhdap- 2026-03-22 4/200 2026-03-22 21:20 by 1144970272
[考研] 328求调剂,英语六级551,有科研经历 +6 生物工程调剂 2026-03-17 10/500 2026-03-22 20:22 by edmund7
[考研] 一志愿武理材料工程348求调剂 +5  ̄^ ̄゜汗 2026-03-19 7/350 2026-03-22 19:44 by 公瑾逍遥
[考研] 298求调剂一志愿211 +3 上岸6666@ 2026-03-20 3/150 2026-03-22 15:50 by ColorlessPI
[考研] 生物学调剂 +5 Surekei 2026-03-21 5/250 2026-03-22 14:39 by tcx007
[考研] 材料学硕301分求调剂 +7 Liyouyumairs 2026-03-21 7/350 2026-03-21 22:31 by peike
[考研] 材料工程专硕 348分求调剂 +3 冬辞. 2026-03-17 5/250 2026-03-21 18:47 by 学员8dgXkO
[考研] 一志愿南大,0703化学,分数336,求调剂 +3 收到VS 2026-03-21 3/150 2026-03-21 18:42 by 学员8dgXkO
[考研] 求调剂 +3 .m.. 2026-03-21 4/200 2026-03-21 16:25 by barlinike
[考研] 083200学硕321分一志愿暨南大学求调剂 +3 innocenceF 2026-03-17 3/150 2026-03-21 02:35 by JourneyLucky
[考研] 324分 085600材料化工求调剂 +4 llllkkkhh 2026-03-18 4/200 2026-03-21 01:24 by JourneyLucky
[考研] 南京大学化学376求调剂 +3 hisfailed 2026-03-19 6/300 2026-03-20 23:43 by hisfailed
[考研] 一志愿中国海洋大学,生物学,301分,求调剂 +5 1孙悟空 2026-03-17 6/300 2026-03-19 23:46 by zcl123
[考研] 320求调剂0856 +3 不想起名字112 2026-03-19 3/150 2026-03-19 22:53 by 学员8dgXkO
[考研] 材料与化工求调剂 +7 为学666 2026-03-16 7/350 2026-03-19 14:48 by 尽舜尧1
[考研] 301求调剂 +4 A_JiXing 2026-03-16 4/200 2026-03-17 17:32 by ruiyingmiao
[考研] 085601求调剂 +4 Du.11 2026-03-16 4/200 2026-03-17 17:08 by ruiyingmiao
[考研] 一志愿南京大学,080500材料科学与工程,调剂 +4 Jy? 2026-03-16 4/200 2026-03-17 11:02 by gaoqiong
[考研] [导师推荐]西南科技大学国防/材料导师推荐 +3 尖角小荷 2026-03-16 6/300 2026-03-16 23:21 by 尖角小荷
信息提示
请填处理意见