标题:学习求助,运行错误,怎么修复
取消只看楼主
Danny0911
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2017-2-8
结帖率:0
已结贴  问题点数:20 回复次数:0 
学习求助,运行错误,怎么修复
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define SIZE 20
int i=0;
FILE*fp;
struct account
{int id;
char name[10];
float balance;
}newone[SIZE];

int main(){
printf("请输入账号:");
scanf("%d",&newone[i].id);
printf("账户名:");
scanf("%s",&newone[i].name);
printf("账户余额:");
newone[i].balance=0.0;
scanf("%f",&newone[i].balance);

if(fopen("date.dat","wb")==NULL){
    printf("cannot open file\n");
    exit(0);
}
if(fwrite(&newone[i],sizeof(struct account)+1,1,fp)!=1)printf("write file orror\n");
fclose(fp);
i++;
}
搜索更多相关主题的帖子: account balance include cannot 修复 
2017-02-08 18:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-474080-1-1.html




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

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