有没有大佬帮忙看看代码,保存文件但是文件是乱码,读取也不成功,这是学校运动会系统(里写自定义目录标题)
请大佬帮忙看看;或许还有大佬知道如何用光标法制作界面吗?
期末大作业想了好久还是不太行!!!!
欢迎使用Markdown编辑器
Sport.h
#ifndef _SPORT_H
#define _SOPRT_H
#include<stdio.h>
#include<math.h>
#include<process.h>
#include<iostream>
using namespace std;
#define N 20 //学校最大数目
#define M 20 //男子项目最大数
#define W 20 //女子项目最大数
static int n;
static int m;
static int w;
//存放项目信息的结构体
typedef struct project
{
char pname[100];
int pnum;//项目编号
int top;//取名次的数目
int prize;//获得次数
int range[5];//名次
int mark[5];//分数
}project;
//存放学校信息的结构体
typedef struct
{
char sname[100];
int snum;//学校编号
int score;//学校总分
int mscore;//男子总分
int wscore;//女子总分
project pro[M + W];//项目数组
}school;
school sch[N];//定义一个学校数组
void readfile1();
void savetofile();
void readfile2();
void sortout();
void input();
#endif /*_SPORT_H*/
input.cpp
#include"Sport.h"
#include"menu.h"
//信息输入功能
void input()
{
printf("输入学校个数(最多%d):",N);
scanf("%d",&n);
printf("输入男子项目个数(最多%d):",M);
scanf("%d",&m);
printf("输入女子项目个数(最多%d):",N);
scanf("%d",&w);
int i,j,q,num;
int npnum;
char npname[100];
int first,second,third,fouth,fifth;
for(i=0;i<n;i++)
{
printf("输入学校编号以及名称:");
scanf("%d%s",&sch[i].snum,&sch[i].sname);
printf("学校录入成功!系统给定编号为:%d\n",i+1);
}
printf("--------学校信息录入成功--------\n");
for(i = 0;i < m+w;i ++)
{
printf("输入项目编号以及名称:");
scanf("%d%s",&npnum);
gets(npname);
for(j=0;j<n;j++)
{
sch[j].pro[i].pnum=npnum;
strcpy(sch[j].pro[i].pname,npname);
sch[j].mscore=sch[j].wscore=sch[j].score=0;
}
printf("------录入项目编号%d %s的成绩------\n",npnum,npname);
printf("请输入该项目取前3还是前5(输入3或5):");
scanf("%d",&num);
for(j=0;j<n;j++)
sch[j].pro[i].top=num;
if(3 == num)
{
printf("第一名学校系统编号:");
scanf("%d",&first);
sch[first-1].pro[i].range[sch[first-1].pro[i].prize]=1;
sch[first-1].pro[i].prize++;
printf("\n");
printf("第二名学校系统编号:");
scanf("%d",&second);
sch[second-1].pro[i].range[sch[second-1].pro[i].prize]=2;
sch[third-1].pro[i].prize++;
printf("\n");
printf("第三名学校系统编号:");
scanf("%d",&third);
sch[third-1].pro[i].range[sch[third-1].pro[i].prize]=3;
sch[third-1].pro[i].prize++;
printf("\n");
}else if(5 == num)
{
printf("第一名学校系统编号:");
scanf("%d",&first);
sch[first-1].pro[i].range[sch[first-1].pro[i].prize]=1;
sch[first-1].pro[i].prize++;
printf("\n");
printf("第二名学校系统编号:");
scanf("%d",&second);
sch[second-1].pro[i].range[sch[second-1].pro[i].prize]=2;
sch[third-1].pro[i].prize++;
printf("\n");
printf("第三名学校系统编号:");
scanf("%d",&third);
sch[third-1].pro[i].range[sch[third-1].pro[i].prize]=3;
sch[third-1].pro[i].prize++;
printf("\n");
printf("第四名学校系统编号:");
scanf("%d",&fouth);
sch[fouth-1].pro[i]