文件都写成就是运行不出来
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define M 30
int peoplenum=0;
struct people
{
int ID;
char Name[50];
int jbgz;
int zwgz;
int jt;
int ylbx;
int gjj;
int sdf;
int yfgz;
int sfgz;
};
struct people peoples[M];
void Serch();//搜寻
void calculate();
void Update();//修改
void Insert();//插入
void Delete();//删除
void Sort();//排序
void Satistics();//统计
void Read();
void chaxun();
void DisplayAll();
//void chaxun();
void menu() /菜单函数/
{
system(“CLS”); /清屏函数 其头文件为“#include<stdlib.h>”/
system("color 0A"); /*屏幕和字体颜色控制*/
printf(" |**********欢迎进入职工工资管理*********| \n");
printf(" | 1.查询职工信息 | \n");
printf(" | 2.计算个人实发工资 | \n");
printf(" | 3.修改记录 | \n");
printf(" | 4.添加记录 | \n");
printf(" | 5.删除记录 | \n");
printf(" | 6.排序 | \n");
printf(" | 7.统计 | \n");
printf(" |**********谢谢使用*********************| \n");
}
int main()
{
menu();
// read();
// chaxun();
// DisplayAll();
//
return 0;
}
void Read()
{
FILE*fp=fopen(“JK0405.txt”,“r”);
int i=0,j;
char st[80];
if(fp==NULL)
{
printf(“文件打开错误!\n”);
return ;
}
fgets(st,80,fp);
while(!feof(fp))
{
fscanf(fp,"%d %s %d %d %d %d %d %d \n",&peoples[i].ID, peoples[i].Name, peoples[i].jbgz, peoples[i].zwgz, peoples[i].jt, peoples[i].ylbx, peoples[i].gjj, peoples[i].sdf);
i++;
}
peoplenum=i;
printf("\n文件读取成功!\n");
fclose(fp);
}
void chaxun()
{
int ind;
while(1)
{
Read();
menu();
printf(“请输入操作编号”);
scanf("%d",&ind);
switch(ind)
{
case 1: DisplayAll(); break;
case 2: Serch(); break;
case 3: calculate(); break;
case 4: Update(); break;
case 5: Insert(); break;
case 6: Sort(); break;
case 7: Satistics(); break;
case 8: exit(1);
}
}
}
void DisplayAll()
{
int i;
printf("\n\n职工号 姓名 基本工资 职务工资 津贴 医疗保险 公积金 水电费 应发工资 实发工资\n");
for(i=0;i<peoplenum;i++)
printf("%d %s %d %d %d %d %d %d %d %d \n",peoples[i].ID, peoples[i].Name, peoples[i].jbgz, peoples[i].zwgz, peoples[i].jt, peoples[i].ylbx, peoples[i].gjj, peoples[i].sdf, peoples[i].yfgz, peoples[i].sfgz);
}