qq_37992487
Nobody knows nobody
采纳率0%
2017-04-16 12:16

vs2013编译,生成没有问题,运行的时候出现错外,说什么120d.dll加载符号之类的东西

#include
#include
#include
#include
#include
#include

struct cause{
char subject[20];
int term;
int grade;

};

typedef struct node{
char name[10];
int num;
int clas;
struct cause data;
struct node*next;
}stu;

void main()

{
node *head, *end, *p;
FILE *fp;
int i = 0;

head = (node *)malloc(sizeof(node));
p = head;
p->next = NULL;

errno_t err;
if ((err = fopen_s(&fp, "class.txt", "r")) == NULL)

//判断文件是否结束
while (!feof(fp))
{   //尾插法建立单链表
    end = (node *)malloc(sizeof(node));
    p->next = end;
    p = end;
    p->next = NULL;
    //读取数据
    fscanf_s(fp, "%d %d %s %d %s %d", &p->num, &p->clas, &p->name, &p->data.term, &p->data.subject, &p->data.grade);
}
fclose(fp);
printf("Data import successfully\n");
p = head->next;
printf("\nnode    name \t \tnum\tage\tsex\t score\n");
while (NULL != p->next)
{
    i++;
    printf("%d %d %s %d %s %d", i, p->num, p->clas, p->name, p->data.term, p->data.subject, p->data.grade);
    p = p->next;
}

}图片说明

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • lixiaogang_theanswer 君子黎 4年前

    LZ:node来定义变量,node来自哪里?应该是stu *head,*end,*p吧

     node *head, *end, *p;
    
    点赞 评论 复制链接分享

相关推荐