c++中打开文件的问题

来源:百度知道 编辑:UC知道 时间:2024/06/16 20:08:52
想做一个积分排名,就是把排名存到一个文件中(可以是txt),然后可以用程序来改写这个排名
如 yy 10000
gg 90000
kk 80000
这样,
求用打开文件,并读入,对比,最后将排行改写的方法来做,谢谢

//这是我大一时帮别人做的词典程序,里面包含读写文件,处理数据等,你改改处理数据那段应该就行了。
// dictionary.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "stdio.h"
#include "string.h"
#include "stdlib.h"

#define M 20
#define N 40

struct word
{
char english[M];
char chinese[N];
};

/***********************************************\
程序名称: 电子词库

程序描述:中英文单词均有
词库文件模型: 前4个字节为词库单词个数。
后面是struct word

有待讨论:

作者信息:
BY 王洋 robotok@sina.com
北京交通大学 计算机与信息技术学院
计算机科学与技术系 JK0506班

历史:
Created on 2006年6月22日
修改:2006年6月24日
\**********************************************/

int main(int argc, char* argv[])
{
int EditWord(char fname[]);
int CreateFile(char fname[]);
int PrintMain();
int ShowWord(char fname[]);
int