c语言里面,如果一个大于256的数字,用字符表示会怎样
charfp;fp=300;printf(fp);还有其中的道路是什么谢谢#include<stdio.h>#include<string.h>#include<coni...
char fp;
fp=300;
printf(fp);
还有其中的道路是什么
谢谢
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <ctype.h>
unsigned char xx[50][80];
int maxline = 0; /* 文章的总行数 */
int ReadDat(void);
void WriteDat(void);
void encryptChar()
{
int i;
char *pf;
for (i=0; i<maxline; i++)
{
pf = xx[i];
while (*pf != 0)
{
if (*pf%2 && *pf*11%256>32)
*pf = *pf*11%256;
pf++;
}
}
}
void main()
{
if (ReadDat())
{
printf("数据文件IN.DAT不能打开!\n\007");
return;
}
encryptChar();
WriteDat();
}
int ReadDat(void)
{
FILE *fp;
int i = 0;
unsigned char *p;
if ((fp = fopen("IN.DAT", "r")) == NULL)
return 1;
while (fgets(xx[i], 80, fp) != NULL)
{
p = strchr(xx[i], '\n');
if (p)
*p = 0;
i++;
}
maxline = i;
fclose(fp);
return 0;
}
void WriteDat(void)
{
FILE *fp;
int i;
fp = fopen("OUT.DAT", "w");
for (i=0; i<maxline; i++)
{
printf("%s\n", xx[i]);
fprintf(fp, "%s\n", xx[i]);
}
fclose(fp);
} 展开
fp=300;
printf(fp);
还有其中的道路是什么
谢谢
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <ctype.h>
unsigned char xx[50][80];
int maxline = 0; /* 文章的总行数 */
int ReadDat(void);
void WriteDat(void);
void encryptChar()
{
int i;
char *pf;
for (i=0; i<maxline; i++)
{
pf = xx[i];
while (*pf != 0)
{
if (*pf%2 && *pf*11%256>32)
*pf = *pf*11%256;
pf++;
}
}
}
void main()
{
if (ReadDat())
{
printf("数据文件IN.DAT不能打开!\n\007");
return;
}
encryptChar();
WriteDat();
}
int ReadDat(void)
{
FILE *fp;
int i = 0;
unsigned char *p;
if ((fp = fopen("IN.DAT", "r")) == NULL)
return 1;
while (fgets(xx[i], 80, fp) != NULL)
{
p = strchr(xx[i], '\n');
if (p)
*p = 0;
i++;
}
maxline = i;
fclose(fp);
return 0;
}
void WriteDat(void)
{
FILE *fp;
int i;
fp = fopen("OUT.DAT", "w");
for (i=0; i<maxline; i++)
{
printf("%s\n", xx[i]);
fprintf(fp, "%s\n", xx[i]);
}
fclose(fp);
} 展开
6个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询