| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 391 人关注过本帖
标题:编译能过但是连接不能过,莫名其妙的错误???
只看楼主 加入收藏
雾雨淼淼
Rank: 2
来 自:甘肃金昌
等 级:论坛游民
帖 子:85
专家分:89
注 册:2010-8-17
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:1 
编译能过但是连接不能过,莫名其妙的错误???
# include <stdio.h>
# include <stdlib.h>
# define MAXWORDS 4
struct information {
  char name[MAXWORDS];
  int sex;
  int years;
}human[10];
void inside_struct(struct information *p,int n);
void save_struct(char *fp,struct information *p,int n);
void outside_struct(struct information *p,int n);
void main()
{
  struct information *q=&human[0];
  //q=human;
  char name_file[20];
  inside_struct(q,10);
  outside_struct(q,10);
  printf("请输入您要保存的文件名\n");
  gets(name_file);
  save_sttruct(name_file,q,10);
  printf("保存完毕,下次见!\n");
}
void inside_struct(struct information *p,int n)
{
  int i;
  printf("请输入%d位人员的信息,\n包括姓名,性别(0为男,1为女),年龄\n中间用空格隔开\n",n);
  for(i=0;i<n;i++)
      scanf("%s%d%d",&((p+i)->name),&((p+i)->sex),&((p+i)->years));
}
void outside_struct(struct information *p,int n)
{
  int i=0;
  printf("您所输入的信息如下:\n");
  printf("姓名\t性别\t年龄\n");
  for(;i<n;i++)
  {
    printf("%s\t",(p+i)->name);
    if((p+i)->sex==0)
        printf("男\t");
    else
        printf("女\t");
    printf("%d",(p+i)->years);
    putchar("\n");
  }
}
void save_struct(char *fp,struct information *p,int n)
{
  int i=0;
  FILE *fpp;
  printf("let's save the information\n");
  if(fpp=fopen(fp,"w")==NULL)
      printf("can't open the file\n");
  for(;i<n;i++)
      fprintf(*fp,"%s\t%d\t%d\t",(p+i)->name,(p+i)->sex,(p+i)->years);
  printf("保存完毕,您可以打开查看");
}
搜索更多相关主题的帖子: 编译 
2010-11-24 22:58
HonryZZ
Rank: 2
等 级:论坛游民
帖 子:13
专家分:59
注 册:2010-11-12
收藏
得分:20 
单词拼错了
save_sttruct(name_file,q,10);
2010-11-24 23:03
快速回复:编译能过但是连接不能过,莫名其妙的错误???
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026482 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved