运行C语言程序时出现cannot execute programe.

#include<stdio.h>#include<stdlib.h>int main(){ char ch; FILE * fp; if((fp=fopen("text.txt","w"))==NULL)) { printf("can not open the file!"); exit(0); } ch=getchar(); while(ch!='!')

{ ch=ch+32; fput(ch,fp); ch=getchar(); } return 0;}

#include<stdio.h>
#include<stdlib.h>
int main()
{
 char ch;
 FILE * fp;
 if((fp=fopen("text.txt","w"))==NULL)
 {
  printf("can not open the file!");
  exit(0);
 }
 ch=getchar();
 while(ch!='!')
 {
  ch=ch+32;
  fputc(ch,fp);
  ch=getchar();
 }
 return 0;
}

试试这样
温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-12-26
#include<stdio.h>
#include<stdlib.h>
int main()
{
char ch;
FILE * fp;
if((fp=fopen("D:\\text.txt","w"))==NULL)
{
printf("can not open the file!");
exit(0);
}
ch=getchar();
while(ch!='!')
{
ch=ch+32;
fputc(ch,fp); /这里你忘记加一个c了/
ch=getchar();
printf("%c",ch);
}
return 0;
}但是这个错误不能出现你的那种情况。可能是兼容性的问题!!! 如果是兼容性的问题我可以帮你解决!!!
相似回答