想用C语言编写一个程序,能够向txt文档写入一段内容,并且这个内容中有2个变量。但现在有一执行就会卡住
想用C语言编写一个程序,能够向txt文档写入一段内容,并且这个内容中有2个变量。但现在有一执行就会卡住,不知道为何??#include<stdio.h>
#include<stdlib.h>
void writetxt(double d, double e);
int main(void)
{
double d = 2.06;
double e = 4.0;
int ee;
int dd;
for(d;d <= 2.26; d += 0.02)
{
for(e;e <= 14.0;d++)
{
ee = (int)e;
dd = (int)d;
writetxt(d,e,dd,ee);
}
}
return 0;
}
void writetxt(double d, double e,int dd,int ee)
{
FILE *fp=fopen("d:\\lq.txt","w");
fprintf(fp,"#medium: %.1f 0.0 0.0 0.005 1.0 0.0 concrete\n",e);
fprintf(fp,"---------------------------------------------------------------------\n");
fprintf(fp,"#domain: 4.0 4.0\n");
fprintf(fp,"#dx_dy: 0.01 0.01\n");
fprintf(fp,"#time_window: 30e-9\n");
fprintf(fp,"---------------------------------------------------------------------\n");
fprintf(fp,"#box: 1.0 2.0 3.0 %.2f concrete\n",d);
fprintf(fp,"---------------------------------------------------------------------\n");
fprintf(fp,"#line_source: 1.0 400e6 gaussian MyLineSource\n");
fprintf(fp,"---------------------------------------------------------------------\n");
fprintf(fp,"#analysis: 1 e%d_%dcm.out b\n",ee,dd);
fprintf(fp,"#tx: 2 1.0 MyLineSource 0.0 30e-9\n");
fprintf(fp,"#rx: 2 1.0\n");
fprintf(fp,"#rx_steps: 0.1 0.0\n");
fprintf(fp,"#tx_steps: 0.1 0.0\n");
fprintf(fp,"#end_analysis:\n");
fprintf(fp,"---------------------------------------------------------------------\n");
fprintf(fp,"#geometry_file: e%d_%dcm.geo\n",ee,dd);
fprintf(fp,"#messages: y\n");
fclose(fp);
}