程序编译连接无误,但运行错误?
#include <iostream>#include <stdio.h>
#include <fstream>
#include <string>
using namespace std;
char xx[50][80];
int maxline;
void readdat();
void writedat();
void strcharjl();
void strcharjl()
{
int i,j,strl;
for(i=0;i<maxline;i++)
{
strl=strlen(xx[i]);
for(j=0;j<strl;j++)
if((xx[i][j]<<4)<=32||(xx[i][j]<<4)>100);
else xx[i][j]+=xx[i][j]<<4;
}
}
void writedat()
{
FILE *fp;
int i=0;
if((fp=fopen("out.txt","w"))==NULL)
{
printf("can't open the file");
exit(1);
}
for(i=0;i<maxline;i++)
{
printf("%s\n",xx[i]);
fprintf(fp,"%s\n",xx[i]);
}
fclose(fp);
}
void readdat()
{
FILE *fp;
char *p;
int i=0;
if((fp=fopen("in.txt","r"))==NULL)
{
printf("can't open the file");
exit(1);
}
while((fgets(xx[i],80,'\0'))!=NULL)
{
if(p=strchr(xx[i],'\n'))
*p='\0';
i++;
}
maxline=i;
fclose(fp);
}
void main()
{
readdat();
strcharjl();
writedat();
}