From 8c8f6672965dd1b4fd6922c8f69b14ae3c1f5210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E5=88=9B?= <17450150319@stu.hut.edu.cn> Date: Mon, 7 Jan 2019 22:37:44 +0800 Subject: [PATCH] first commit --- a.txt | 1 + main.cpp | 239 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 240 insertions(+) create mode 100644 a.txt create mode 100644 main.cpp diff --git a/a.txt b/a.txt new file mode 100644 index 0000000..9ce8cd7 --- /dev/null +++ b/a.txt @@ -0,0 +1 @@ +114514 Cierra famale 114514 0 \ No newline at end of file diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..88bb3d5 --- /dev/null +++ b/main.cpp @@ -0,0 +1,239 @@ +#include +#include /*其它说明*/ +#include /*字符串函数*/ +#include +#define max 100 +#define LEN 15 +#define N 50 +int k = 1, n = 0, m = 0; + +typedef struct student { + char no[13];//卡号 + char name[10];//姓名 + char sex[8];//性别 + int balance;//余额 + char passwd[20]; +} student, stu[max]; +void fileWrite(int n, stu s); +void modify() { + int j = 0; + FILE * fp; + if ((fp = fopen("a.txt", "r")) == NULL) return; + stu s; + while (fscanf(fp, "%s %s %s %s %d ", &s[j].no, &s[j].name, &s[j].sex[j],&s[j].passwd, &s[j].balance) == 5) { + j++; + } + n = j; + int i, item, num; + int age; + char sex1[8], s1[LEN + 1], s2[LEN + 1],passwd1[20],age1[10]; + float score1; + printf("请输入要修改的用户的卡号:\n"); + scanf("%s", s1); + for (i = 0; i