该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
这是我写的程序,检查无误,但运行不了,不过我这水平也只能做到这份上了,求大神指教,以后我一定好好学习
#include
#include
#include
#include
void main()
{
int a,b,c,d,a2,b2,c2,d2;
char str[31];
FILE *fp;
fp=fopen("L1.txt","r");
if(fp==NULL)
printf("failed to open the file");
else
{
rewind(fp);//文件指针归位
printf("现在光标:%x\n",fp->_ptr);//显示当前光标所在位置
while(!feof(fp))
{
memset(str,0,31);//清理备用内存
fgets(str,31,fp);//获取第一排数字
sscanf(str, "%d", a);
printf("%d\n",a);
fgets(str,31,fp);
sscanf(str,"%f",b);
printf("%f",b);
fgets(str,31,fp);
sscanf(str, "%f", c);
printf("%f\n",c);
fgets(str,31,fp);
sscanf(str,"%f",d);
printf("%f",d);
fgets(str,31,fp);//获取第二排数字
sscanf(str, "%d", a2);
printf("%d\n",a2);
fgets(str,31,fp);
sscanf(str,"%f",b2);
printf("%f",b2);
fgets(str,31,fp);
sscanf(str, "%f", c2);
printf("%f\n",c2);
fgets(str,31,fp);
sscanf(str,"%f",d2);
printf("%f",d2);
moveto(a,b);
lineto(a2,b2);
}
fclose(fp);
system("pause");
}
}