| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 572 人关注过本帖
标题:<一维非稳态导热问题计算程序>能编译成功并生成可执行文件,但不能运行?? ...
取消只看楼主 加入收藏
Vlture_
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2013-10-25
结帖率:50%
收藏
已结贴  问题点数:20 回复次数:0 
<一维非稳态导热问题计算程序>能编译成功并生成可执行文件,但不能运行???
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>

double proc(int DT,int N,double A[],double C[],double B[],double D[],double T[])
{
    double P[20],Q[20],F;
    int i;
//    double T[20];

    P[1]=-C[1]/B[1];
    Q[1] = D[1] / B[1];
        for(i=2;i<N;i++)
        {    F = B[i] + A[i] * P[i - 1];
            Q[i] = (D[i] - A[i] * Q[i - 1]) / F;
            scanf("%lf",&Q[i]);
            P[i] = -C[i] / F;
            scanf("%lf",&P[i]);
        }
        for(i=N-1;i>0;i--)
        {    T[i] = Q[i] + P[i] * T[i + 1];     //22
        //    scanf("%lf",T[i]);
        }
        return T[i];
}


void main()
{
    int N,ID,M,DT,i,IR,AT;
    double A[20],C[20],T[20];         //32
    double X,L[20],TE,B[20],D[20];
    printf("Çëêäèë½úμãμÄ×üêy:N\n");
        scanf("%d",&N);
    printf("ÇëêäèëË2ì¬μü′ú′Îêy:ID\n");
        scanf("%d",&ID);
    printf("êäèëÎTῸùêy£o M\n");
        scanf("%d",&M);
    printf("êäèëÎTῸùê±¼ä2½3¤fe :  DT\n");
        scanf("%d", &DT);
    X = 1.0 / (N - 2);
   L[1] = 0; L[2] = 0.5 * X;
   for  (i = 3; i<=N - 1;i++)
   {
        L[i] = L[i - 1] + X;
        scanf("%lf",&L[i]);
   }
    L[N] = L[N - 1] + 0.5 * X;
    IR = 0; AT = 0;
    for( i = 1 ;i<= N;i++)
    {
        T[i] = 1.0;
        scanf("%lf",&T[i]);

    }
     while (IR <= ID)
     {
        IR = IR + 1;
        AT = AT + DT; TE = 1.0 / DT;       //61
        for (i = 2 ;i<= N - 1;i++)
        {
            A[i] = 1.0;
            scanf("%lf",&A[i]);
            C[i] = 1.0;
            scanf("%lf",&C[i]);
            B[i] = -(2 + M * M * X * X + TE);
            scanf("%lf",&B[i]);
            D[i] = -TE * T[i];
            scanf("%lf",&D[i]);           //71
        }
        C[1] = 2.0; scanf("%lf",&C[1]) ;  B[1] = -(2 + M * M * X * X); scanf("%lf",&B[1]);
        A[2] = 2.0; B[2] = B[2] - 1; B[N - 1] = B[2];
        C[N - 1] = 2.0;
        B[N] = 1.0; D[N] = 1.0;scanf("%lf",&B[N]);scanf("%lf",&D[N]);
        proc (DT,N,A,C,B,D,T);
    printf("IR=%d",IR);
    printf("          X*");
    printf("               T*\n");
        for(i=1;i<=N;i++)
        {  if (i!=10)
        {
         printf("X(%d)=",i);
         printf("%10f",L[i]);
         printf("%15lf\n",T[i]);
        }
        else
        {printf("X(%d)=",i);
         printf("%10f",L[i]);
         printf("%15lf\n",T[i]);
         printf("\n");
        }
        }
     }
     
   

        

}
搜索更多相关主题的帖子: include 执行文件 double 
2013-10-25 13:50
快速回复:<一维非稳态导热问题计算程序>能编译成功并生成可执行文件,但不能运行 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018339 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved