当前位置: 代码迷 >> C语言 >> [求助] 程序不能运行
  详细解决方案

[求助] 程序不能运行

热度:167   发布时间:2007-10-08 18:23:18.0
[求助] 程序不能运行
有两个磁盘文件A和B,各存放一行字母,要求把这两个文件中的信息合并(按字母顺序排列),
输出到一个新文件C中

#include<stdio.h>
main()
{
char c,d,e,str[100],st[45];
int i,j;
FILE *fp,*dp;
if((fp=fopen("e:\\s","w"))==NULL);
{
printf("can't open this file\n");
exit(0);
}
if((dp=fopen("e:\\ss","w"))==NULL);
{
printf("can't open this file\n");
exit(0);
}
while((c=getchar())!='*')
{
fputc(c,fp);
c=getchar();
}
fclose(fp);
printf("\n\n");
while((d=getch())!='#')
{
fputc(d,dp);
d=getchar();
}
fclose(dp);
fp=fopen("e:\\s","r");
fgets(str,strlen(str)+1,fp);
printf("%s\n",str);
fclose(fp);
dp=fopen("e:\\ss","r");
fgets(st,strlen(st)+1,dp);
strcat(str,st);
fclose(dp);
for(i=0;i<strlen(str);i++)
{
for(j=1;j<strlen(str);j++)
{
if(str[i]>str[j])
e=str[j];
str[j]=str[i];
str[i]=e;
j++;
}
i++;
}
fp=fopen("e:\\s","w");
do
{
i=0;
fputc(str[i],fp);
i++;
}while(str[i]!='\0');
fclose(fp);
system("pause");
}
我用的是TC,就输出can't open this file,哪个帮我看看是怎么回事??
搜索更多相关的解决方案: 运行  

----------------解决方案--------------------------------------------------------
怎么没注释。......
----------------解决方案--------------------------------------------------------
  相关解决方案