在WSL上,C代码被编译但在运行时,终端冻结并且光标一直闪烁

时间:2018-04-19 20:11:51

标签: c compilation windows-subsystem-for-linux

#include<stdio.h>
#include<math.h>

void main()
{
    float yAl1, yAl2, yNi1, yNi2, Gref, GHSERAL, GHSERNI, GAl_Al, GAl_Ni, GNi_Al, GNi_Ni, Gconf, GE, G[11], T, LAlNi_Al_0, LAlNi_Ni_0, LAl_AlNi_0, LNi_AlNi_0, LAlNi_Ni_1, LNi_AlNi_1;
    int i;
    FILE *fp;

    T = 1200;

    GHSERAL = -11278.4+(188.684*T)-(31.7482*T*(log(T)))-(1.231*(pow(10,28))*(pow(T,-9)));
    GHSERNI = -5179.16+(117.854*T)-(22.096*T*(log(T)))-(0.0048407*(pow(T,2)));

    GAl_Al = 10083-(4.813*T)+GHSERAL;
    GAl_Ni = -56500-(10.7*T)+(1.4975*T*(log(T)))+(0.5*GHSERAL)+(0.5*GHSERNI);
    GNi_Al = GAl_Ni;
    GNi_Ni = 8715.08-(3.556*T)+GHSERNI; 

    LAlNi_Al_0 = -14225-(5.625*T);
    LAlNi_Ni_0 = -22050;
    LAl_AlNi_0 = LAlNi_Al_0;
    LNi_AlNi_0 = LAlNi_Ni_0;
    LAlNi_Ni_1 = 1115;
    LNi_AlNi_1 = LAlNi_Ni_1;

    for(i=0; i<11; i=i++)
    {
        yNi2 = i/10;
        yAl1 = -0.2 + yNi2;
        yAl2 = 1 - yNi2;
        yNi1 = 1.2 - yNi2;

        Gref = yAl1*((yAl2*GAl_Al) + (yNi2*GAl_Ni)) + yNi1*((yAl2*GNi_Al) + (yNi2*GNi_Ni));

        Gconf = 8.314*T*(0.5*(yAl1*(log(yAl1)) + yNi1*(log(yNi1))) + 0.5*(yAl2*(log(yAl2)) + yNi2*(log(yNi2))));    

        GE = yAl1*yNi1*((yAl2*LAlNi_Al_0) + (yNi2*(LAlNi_Ni_0 + LAlNi_Ni_1*(yAl1-yNi1)))) + yAl2*yNi2*((yAl1*LAl_AlNi_0) + (yNi1*(LNi_AlNi_0 + LNi_AlNi_1*(yAl2-yNi2))));

        G[i] = Gref + Gconf + GE;
    }

    fp = fopen("Assignment_3.csv","w+");
    fprintf(fp, "yNi2, G (J/K.mol) \n");

    for(i=0; i<11; i++)
    {
        fprintf(fp, "%f, %f\n", (float) i/10, G[i]);
    }

    fclose(fp);
}

0 个答案:

没有答案