这个是本人的一个课程设计,五子棋小游戏。
代码:

#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#define N 15                                            /*棋盘大小*/
void Log();                                                /*登录*/
void tie();                                                /*和棋界面*/
void pre();                                             /*未登录提示*/
void menu();                                            /*主菜单,开始游戏,游戏设置,游戏介绍,排行榜,退出游戏*/
void pause();                                            /*菜单*/
void Getrun();                                            /*下棋模块*/
void player();                                            /*玩家状态*/
void window();                                            /*窗口设置*/
void regist();                                            /*注册*/
void member();                                            /*游戏开发人员介绍*/
void Set_up();                                          /*游戏设置*/
void welcome();                                            /*欢迎界面*/
int Forbidden();                                        /*判断禁手*/
void forbidden();                                       /*禁手设置*/
void introduce();                                       /*游戏介绍*/
void win(char ab);                                        /*win界面*/
void Change(char ab);                                   /*密码修改*/
void Log_AB(char ab);                                    /*玩家AB的登录注销界面*/
void Log_in(char ab);                                    /*玩家AB登录*/
void Log_out(char ab);                                    /*玩家AB注销界面*/
void Game_h(char input);                                /*悔棋函数*/
int check(int x, int y);                                /*判断输赢*/
void gotoxy(int x, int y);                                /*实现光标跳跃*/
void print(int Cx, int Cy);                              /*打造棋盘*/
void rank(char user, char r_w);                            /*排行榜*/
void find(int x, int y, int k);                         /*查找棋子*/
int pieces[N][N] = {0}, Cx, Cy;
int next[8][2] = {{0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}, {1, 0}, {1, 1}};
int flag, count = 0, temp = 0, vis = 0, countpieces = 0, log_a = 0, log_b = 0, forbid = 0;
char bz[10] = {"color E0"};                                /*默认背景、字体颜色*/
char log_AAccount[20] = {0}, log_BAccount[20] = {0};
struct Find{
    int ans, ans1, ans2;
}f[10];
struct XY {                                             /*记录每次下棋的位置*/
        int x, y;
};
struct node {                                             /*利用链表把下棋的位置串起来*/
    struct XY data;
    struct node *next, *last;
};
struct rank {
    int num, s_num;
    char account[20], name[50];
}ran, ra, rb;
struct noda {
    struct rank data;
    struct noda *next;
};
typedef struct noda Node, *LinkLista;
LinkLista heada;
typedef struct node LNode, *LinkList;
LinkList head, prun;
int main()
{
    char ch;
    rank('a', 'r');                                        /*将排行读入内存*/
    system("title 简易五子棋 ——第一组制作");            /*设置标题*/
    system("mode con cols = 62 lines = 41");            /*设置窗口大小*/
    system(bz);                                            /*设置颜色*/
    welcome();                                          /*进入欢迎界面*/
    while (ch = getch(), ch != '\r');                   /*回车继续*/
    while (1)
    {
        char n;
        system("CLS");                                  /*清屏*/
        system(bz);                                     /*更新背景字体颜色*/
        menu();                                         /*进入主菜单界面*/
        while (n = getch(), !(n >= '0' && n <= '5') && n != 'r' && n != 'l');/*判断是否为有效数字*/
        switch(n)
        {
            case '0': return 0;                         /*如果输入为零,退出游戏*/
            case '1': Getrun(); break;                  /*进入下棋界面*/
            case '2': Set_up(); break;                  /*进入设置界面*/
            case '3': introduce(); break;
            case '4': rank('r', 'r'); break;
            case '5': member(); break;
            case 'r': regist(); break;
            case 'l': Log(); break;
        }
    }
    return 0;
}
void print(int Cx, int Cy)                              /*打造棋盘*/
{
    if (Cx == 0)
    {
        for (int j = -1; j < N; j++)
        {
            if (j == Cy - 1 && Cx == 0)
                printf("┏");
            else if (j == Cy && Cx == 0)
                printf("  ┓");
            else printf("    ");
        }
    }
    printf("\n");
    for (int i = 0; i < 2 * N - 1; i++)
     {
          if (Cy == 0 && i == Cx - 1)
            printf("┏");
        else if (Cy == 0 && i == Cx + 1)
            printf("┗");
        else printf("  ");
        for (int j = 0; j < N; j++)
          {
            if (i == 0)
               {
                if (j == 0)
                {
                    if (pieces[i / 2][j] == 0)          /*如果为0,证明无子*/
                        printf("┏━");
                    else if (pieces[i / 2][j] == 1)     /*先手棋*/
                        printf("●━");
                    else if (pieces[i / 2][j] == 2)     /*后手棋*/
                        printf("○━");
                }
                else if (j == N - 1)
                {
                    if (pieces[i / 2][j] == 0)
                        printf("┓");
                    else if (pieces[i / 2][j] == 1)
                        printf("●");
                    else if (pieces[i / 2][j] == 2)
                        printf("○");
                }
                else
                {
                    if (pieces[i / 2][j] == 0)
                        printf("┯━");
                    else if (pieces[i / 2][j] == 1)
                        printf("●━");
                    else if (pieces[i / 2][j] == 2)
                        printf("○━");
                }
            }
            else if (i == 2 * N - 2)
            {
                if (j == 0)
                {
                    if (pieces[i / 2][j] == 0)
                        printf("┗━");
                    else if (pieces[i / 2][j] == 1)
                        printf("●━");
                    else if (pieces[i / 2][j] == 2)
                        printf("○━");
                }
                else if (j == N - 1)
                {
                    if (pieces[i / 2][j] == 0)
                        printf("┛");
                    else if (pieces[i / 2][j] == 1)
                        printf("●");
                    else if (pieces[i / 2][j] == 2)
                        printf("○");
                }
                else
                {
                    if (pieces[i / 2][j] == 0)
                        printf("┷━");
                    else if (pieces[i / 2][j] == 1)
                        printf("●━");
                    else if (pieces[i / 2][j] == 2)
                        printf("○━");
                }
            }
            else
            {
                if (i % 2 == 1)
                {
                    if (j == 0 || j == N - 1)
                    {
                        if (j == Cy - 1 && i == Cx - 1)
                            printf("┃┏");
                        else if (j == Cy && i == Cx - 1)
                            printf("┃┓");
                        else if (j == Cy - 1 && i == Cx + 1)
                            printf("┃┗");
                        else if (j == Cy && i == Cx + 1)
                            printf("┃┛");
                        else printf("┃  ");
                    }
                    else if (j == Cy - 1 && i == Cx - 1)
                        printf( "│┏");
                    else if (j == Cy && i == Cx - 1)
                        printf("│┓");
                    else if (j == Cy - 1 && i == Cx + 1)
                        printf("│┗");
                    else if (j == Cy && i == Cx + 1)
                        printf("│┛");
                    else printf("│  ");
                }
                else
                {
                    if (j == 0)
                    {
                        if (pieces[i / 2][j] == 0)
                            printf("┠─");
                        else if (pieces[i / 2][j] == 1)
                            printf("●─");
                        else if (pieces[i / 2][j] == 2)
                            printf("○─");
                    }
                    else if (j == N - 1)
                    {
                        if (pieces[i / 2][j] == 0)
                            printf("┨");
                        else if (pieces[i / 2][j] == 1)
                            printf("●");
                        else if (pieces[i / 2][j] == 2)
                            printf("○");
                    }
                    else
                    {
                        if (pieces[i / 2][j] == 0)
                            printf("┼─");
                        else if (pieces[i / 2][j] == 1)
                            printf("●─");
                        else if (pieces[i / 2][j] == 2)
                            printf("○─");
                    }
                }
            }
        }
        printf("\n");
    }
    if (Cx + 2 == 2 * N)
    {
        for (int j = -1; j < N; j++)
        {
            if (j == Cy - 1 && Cx + 2 == 2 * N)
                printf("┗");
            else if (j == Cy && Cx + 2 == 2 * N)
                printf("  ┛");
            else printf("    ");
          }
    }
    printf("\n");
    if (!vis)
        player();                                       /*在棋盘的最下面打印下棋玩家*/
}
void Getrun()
{
G:    char ch;
    if (!log_a || !log_b)                               /*有玩家未登录*/
    {
        pre();                                          /*进入提示界面*/
        while (ch = getch(), ch != 'Y' && ch != 'N' && ch != 'y' && ch != 'n' && ch != '*');
        switch(ch)
        {
            case 'y':
            case 'Y': break;                            /*确定进入*/
            case 'n':
            case 'N':
            case '*': return ;                          /*取消进入*/
        }
    }
    Cy = N / 2, Cx = (2 * N - 1) / 2;                   /*初始方标位置*/
    int winner, input;
    LinkList p, p1;
    prun = p1 = head = (LinkList)malloc(sizeof(LNode)); /*申请一个内存空间*/
    head -> last = head -> next = NULL;                 /*使链表的头和尾指向空*/
    p1 -> data.x = Cx / 2;
    p1 -> data.y = Cy;
    countpieces = 0;                                    /*计算落子数*/
    flag = 1, vis = 0;
    memset(pieces, 0, sizeof(pieces));                  /*初始化下棋数组*/
    while (countpieces < N * N)
    {
H:        system("CLS");                                  /*清屏*/
        print(Cx, Cy);                                    /*打造棋盘*/
        if (temp)                                       /*显示提示信息*/
        {
            printf("已有棋子,请重新下棋!");
            temp = 0;
        }
        while (input = getch(), input != '+' && input != '-' && input != '*' &&
        (flag != 2 || input != 0xE0) && !(flag == 1 && (input == 0x77 || input == 0x73 ||
        input == 0x61 || input == 0x64)) && !(flag == 1 && input == 0x20 || flag == 2 && input == 0x4F));
        if (input == '+' || input == '-')               /*判断是否为悔棋和复棋*/
        {
            Game_h(input);                              /*进行悔棋复棋*/
            goto H;
        }
        else if (input == '*')                          /*如果为*,打开菜单*/
        {
P:            pause();                                    /*进入菜单*/
            while (ch = getch(), !(ch <= '5' && ch >= '0'));
            switch(ch)
            {
                case '0': return ;                        /*如果是0则退出程序*/
                case '1': break;                        /*继续游戏*/
                case '2': goto G;                       /*开始新游戏*/
                case '3': Set_up(); goto P;             /*进入设置界面*/
                case '4': introduce(); goto P;          /*进入游戏介绍*/
                case '5': rank('r', 'r'); goto P;       /*查看游戏介绍*/
            }
        }
        else
        {
            if (flag == 2 && input == 0xE0)                /*如果按下的是方向键,会填充两次输入,第一次为0xE0表示按下的是控制键*/
            {
                input = getch();                        /*获得第二次输入信息*/
                switch(input)                            /*判断方向键方向并移动光标位置*/
                {
                    case 0x4B : Cy--; break;
                    case 0x48 : Cx-=2; break;
                    case 0x4D : Cy++; break;
                    case 0x50 : Cx+=2; break;
                }
            }
            else if (flag == 1 && (input == 0x77 || input == 0x73 || input == 0x61 || input == 0x64))
            {
                switch(input)                            /*判断字母键方向并移动光标位置*/
                {
                    case 0x61 : Cy--; break;
                    case 0x77 : Cx-=2; break;
                    case 0x64 : Cy++; break;
                    case 0x73 : Cx+=2; break;
                }
            }
            if(Cy < 0)
                Cy = N - 1;                                /*如果光标位置越界则移动到对侧*/
            if(Cx < 0)
                Cx = 2 * N - 2;
            if(Cy > N - 1)
                Cy = 0;
            if(Cx > 2 * N - 1)
                Cx = 0;

        }
        if (flag == 1 && input == 0x20 || flag == 2 && input == 0x4F)
        {
            if (pieces[Cx / 2][Cy] == 0)                /*判断是否可以落子*/
            {                                            /*可以落子*/
                p1 = prun;                              /*更新下棋的顺序*/
                pieces[Cx / 2][Cy] = flag;
                countpieces++;
                if (flag == 1)                            /*改变游戏状态*/
                    flag = 2;
                   else flag = 1;
                   p = (LinkList)malloc(sizeof(LNode));    /*存下每次下棋的位置*/
                p -> data.x = Cx / 2;
                p -> data.y = Cy;
                p -> last = p1;
                p -> next = NULL;
                p1 -> next = p;
                prun = p1 = p;
                   winner = check(Cx / 2, Cy);                /*检查判断输赢和游戏是否继续*/
                   if (winner != 1 && flag == 2 && forbid && Forbidden())
                    winner = 2;
                   if (winner || countpieces == N * N)
                       vis = 1;
                   if (winner == 1)                        /*A赢了*/
                   {
                       system("CLS");                      /*清屏*/
                    print(Cx, Cy);                        /*重画棋盘*/
                    if (log_a && log_b)
                        rank('A', 'w');
                       win('A');
                       break;
                }
                else if (winner == 2)                    /*B赢了*/
                {
                    system("CLS");                      /*清屏*/
                    print(Cx, Cy);                        /*重画棋盘*/
                    if (log_a && log_b)
                        rank('B', 'w');
                    win('B');
                       break;
                }
            }
            else                                        /*该位置已有棋子*/
            {
                temp = 1;                               /*标记一下*/
                system("CLS");                          /*清屏*/
                print(Cx, Cy);                            /*重画棋盘*/
            }
        }
    }
    if (countpieces == N * N)                            /*和棋*/
        tie();                                          /*打印和棋界面*/
    while (ch = getch(), ch != '\r');                   /*按回车继续*/
}
int check(int x, int y)                                    /*判断输赢*/
{
    int count[8] = {0};                                  /*count置初值*/
    for (int k = 0; k < 8; k++)
    {
        int i = x, j = y;
        i += next[k][0];
        j += next[k][1];
        while (i >= 0 && i < N && j >= 0 && j < N && count[k] < 5)
        {
            if (pieces[i][j] == pieces[x][y])           /*判断是否有落子及是否为同一玩家*/
                count[k]++;
            else break;                                   /*无落子或不是同一玩家,退出循环*/
            i += next[k][0];
            j += next[k][1];
        }
    }
    for (int k = 0; k < 4; k++)
        if (count[k] + count[k + 4] >= 4)               /*判断能否组成五子*/
            return pieces[x][y];
    return 0;                                            /*未形成五子连成一条线的状态,返回0*/
}
void find(int x, int y, int k)                          /*查找棋子*/
{
    int i = x, j = y;
    i += next[k][0];                                    /*向规定方向查找*/
    j += next[k][1];
    while (1)
    {
        if (i <= 0 || i >= N - 1 || j <= 0 || j >= N - 1)
            return ;                                    /*到边界退出*/
        if (pieces[i][j] == pieces[x][y])               /*判断是否为同一棋子*/
            f[k].ans++;                                 /*棋子个数加一*/
        else if (!pieces[i][j])                         /*还未下棋*/
        {
            if (!f[k].ans1 && pieces[i + next[k][0]][j + next[k][1]] == pieces[x][y] && pieces[i - next[k][0]][j - next[k][1]] == pieces[x][y])
                f[k].ans1++;                            /*两边不为该棋子,中间空格数加一*/
            else
            {
                f[k].ans2++;                            /*两头空格数加一*/
                if (pieces[i + next[k][0]][j + next[k][1]] == pieces[x][y])
                    return ;
            }
        }
        else return ;
        if (f[k].ans2 >= 2)                             /*两头空格数大于一退出*/
            return ;
        i += next[k][0];                                /*继续走*/
        j += next[k][1];
    }
}
int Forbidden()                                         /*判断三三禁手*/
{
    for (int i = 0; i < N; i++)
        for (int j = 0; j < N; j++)                     /*遍历整个棋盘*/
        {
            memset(f, 0, sizeof(f));
            if (pieces[i][j] == 1)                      /*如果为黑棋,进入*/
               {
                for (int k = 0; k < 8; k++)
                    find(i, j, k);                      /*找出八个方向的棋子数空格数*/
                for (int k = 0; k < 4; k++)
                    for (int u = 0; u < 4; u++)
                        if (u != k)                     /*判断两个列,行,斜行*/
                            if ((f[k].ans + f[k + 4].ans == 2 && (!(f[k].ans1 + f[k + 4].ans1) && f[k].ans2 + f[k + 4].ans2 >= 3
                            || (f[k].ans1 + f[k + 4].ans1 == 1 && f[k].ans2 && f[k + 4].ans2)))
                            && (f[u].ans + f[u + 4].ans == 2 && (!(f[u].ans1 + f[u + 4].ans1) && f[u].ans2 + f[u + 4].ans2 >= 3
                            || f[u].ans1 + f[u + 4].ans1 == 1 && f[u].ans2 && f[u + 4].ans2)))
                                return 1;
               }
        }
    return 0;
}
void welcome()                                            /*打印欢迎界面*/
{
    system("CLS");                                      /*清屏*/
    printf("\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    printf("  *                                                        *\n");
    printf("  *                       *五 子 棋*                       *\n");
    printf("  *                                                        *\n");
    printf("  *                *欢迎使用五子棋对战程序*                *\n");
    printf("  *                     *祝您玩的愉快*                     *\n");
    printf("  *                                                        *\n");
    printf("  *                      ╔════╗                      *\n");
    printf("  *                      ║ 确  定 ║                      *\n");
    printf("  *                      ╚════╝                      *\n");
    printf("  *                                                        *\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n  ");
}
void menu()                                             /*打印主菜单界面*/
{
    system("CLS");                                      /*清屏*/
    printf("\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    printf("  *                       *主 菜 单*  r.注册.r  l.用户.l * *\n");
    printf("  * ****************************************************** *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                   1.*开始游戏*.1                   * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                   2.*游戏设置*.2                   * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                   3.*游戏介绍*.3                   * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                    4.*排行榜*.4                    * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                   5.*开发成员*.5                   * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                   0.*退出游戏*.0                   * *\n");
    printf("  * *                                                    * *\n");
    printf("  * ****************************************************** *\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n  ");
}
void pre()
{
    system("CLS");                                      /*清屏*/
    printf("\n");                                        /*打造选择玩家界面*/
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    printf("  *             *玩家还未登录确定进入游戏吗?*             *\n");
    printf("  *          *不登录,将不保存玩家本局的任何信息*          *\n");
    printf("  *  ****************************************************  *\n");
    printf("  *  ************  ╔════╗ ╔════╗ ************  *\n");
    printf("  *  ********      ║Y.确定.Y║ ║N.取消.N║     ********  *\n");
    printf("  *  ************  ╚════╝ ╚════╝ ************  *\n");
    printf("  *  ****************************************************  *\n");
    printf("  *                         *返回*                         *\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n  ");
}
void Set_up()
{
    char c;
l:    system("CLS");                                      /*清屏*/
    printf("\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    printf("  *                       *游戏设置*                     * *\n");
    printf("  * ****************************************************** *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                   1.*禁手设置*.1                   * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                 2.*背景字体设置*.2                 * *\n");
    printf("  * *                                                    * *\n");
    printf("  * ****************************************************** *\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n  ");
    while (c = getch(), c != '1' && c != '2' && c != '*');
    switch(c)
    {
        case '*': return ;
        case '1': forbidden(); break;
        case '2': window(); break;
    }
    goto l;
}
void forbidden()
{
    char c;
    system("CLS");                                      /*清屏*/
    printf("\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    if (forbid)
        printf("  *                 *已开启禁手,请选择:*                 *\n");
    else printf("  *                 *已关闭禁手,请选择:*                 *\n");
    printf("  *  ****************************************************  *\n");
    printf("  *  ************  ╔════╗ ╔════╗ ************  *\n");
    printf("  *  ********      ║N.开启.N║ ║F.关闭.F║     ********  *\n");
    printf("  *  ************  ╚════╝ ╚════╝ ************  *\n");
    printf("  *  ****************************************************  *\n");
    printf("  *                         *返回*                         *\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n  ");
    while (c = getch(), c != 'N' && c != 'F' && c != 'n' && c != 'f' && c != '*');/*判断是否为以上字符*/
    switch(c)
    {
        case '*': return ;
        case 'n':
        case 'N': forbid = 1; break;
        case 'f':
        case 'F': forbid = 0; break;
    }
    if (forbid)
        printf("开启成功!");
    else printf("关闭成功!");
    while (c = getch(), c != '\r');
}
void window()                                           /*打印设置界面*/
{
L:    int ans = 0;
    char b = 0, z = 0, c, ch, b_z[2];                   /*初始化数据*/
    system(bz);                                         /*更新颜色*/
    system("CLS");                                      /*清屏*/
    printf("\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    printf("  * ****************************************************** *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                0 = 黑色    8 = 灰色                * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                1 = 蓝色    9 = 淡蓝色              * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                2 = 绿色    A = 淡绿色              * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                3 = 湖蓝*** = 淡浅绿色            * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                4 = 红色    C = 淡红色              * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                5 = 紫色    D = 淡紫色              * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                6 = 黄色    E = 淡黄色              * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                7 = 白色    F = 亮白色              * *\n");
    printf("  * *                    ╔════╗                    * *\n");
    printf("  * *                    ║* 返回 *║                    * *\n");
    printf("  * *                    ╚════╝                    * *\n");
    printf("  * ****************************************************** *\n");
    printf("  * *                                                    * *\n");
    printf("  * *  请输入背景颜色对应的编码:                        * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *  请输入字体颜色对应的编码:                        * *\n");
    printf("  * *                                                    * *\n");
    printf("  * ****************************************************** *\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    gotoxy(33, 24);                                     /*使光标跳到指定位置*/
    while (c = getch())                                 /*输入操作的字符*/
    {
        if (c == '*')                                   /*返回上次界面*/
            return ;
        if (c == '\r' && ans > 0)                       /*跳到字体颜色输入*/
            break;
        if (!(c >= '0' && c <= '9' || c >= 'a' && c <= 'f' || c >= 'A' && c <= 'F')) /*不是上面合法字符*/
        {
            if (c == 8 && ans > 0)                      /*判断是否为删除键*/
            {
                ans--;                                  /*删除*/
                b = 0;
                printf("\b \b");                        /*覆盖*/
            }
            continue;
        }
        if (ans < 1)                                    /*最多输入一个*/
        {
            printf("%c", c);                            /*打印输入字符*/
            b = c;
            ans++;                                      /*个数加一*/
        }
    }
    ans = 0;                                            /*初始化个数*/
    gotoxy(33, 26);                                     /*使光标跳到指定位置*/
    while (c = getch())
    {
        if (c == '*')                                   /*返回上次界面*/
            return ;
        if (c == '\r' && ans > 0)                       /*输入结束*/
            break;
        if (fabs(b - c) == 0 || fabs(b - c) == 32 || !(c >= '0' && c <= '9' || c >= 'a' && c <= 'f' || c >= 'A' && c <= 'F'))
        {                                               /*不满足上面字符*/
            if (c == 8 && ans > 0)                      /*判断删除键*/
            {
                ans--;                                  /*删除*/
                z = 0;
                printf("\b \b");                        /*覆盖*/
            }
            continue;
        }
        if (ans < 1)                                    /*最多输入一个*/
        {
            printf("%c", c);                            /*打印输入字符*/
            z = c;
            ans++;                                      /*个数加一*/
        }
    }
    gotoxy(0, 30);                                      /*光标回位*/
    sprintf(b_z, "color %c%c", b, z);                   /*构建颜色字串*/
     system(b_z);                                        /*输出输入颜色*/
     printf("       ╔═════╗                    ╔═════╗     \n");
    printf("       ║+确定更改+║                    ║-重新设置-║     \n");
    printf("       ╚═════╝                    ╚═════╝     \n");
    printf("  ");
    while (ch = getch(), ch != '+' && ch != '-' && ch != '*');
    if (ch == '*')                                      /*返回界面*/
        return ;
    switch(ch)                                          /*判断是否更改*/
    {
        case '+': strcpy(bz, b_z); break;
        case '-': system("CLS"); goto L;
    }
}
void introduce()
{
    system("CLS");
    FILE *fp;
    char c;
    fp = fopen("introduce.txt", "r");
    while (~fscanf(fp, "%c", &c))
    {
        printf("%c", c);
    }
    fclose(fp);
    while (c = getch(), c != '\r');
}
void player()                                           /*打印下棋状态提示*/
{
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    printf("  *               *悔-棋*            *复+棋*               *\n");
    printf("  *  ****************************************************  *\n");
    printf("  *  ***************                      ***************  *\n");
    if (flag == 1)
        printf("  *  ***********       *请玩家A●下棋!*       ***********  *\n");
    else printf("  *  ***********       *请玩家B○下棋!*       ***********  *\n");
    printf("  *  ***************                      ***************  *\n");
    printf("  *  ****************************************************  *\n");
    printf("  *                         *暂停*                         *\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n  ");
}
void win(char ab)                                        /*打印胜利界面*/
{
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    printf("  *                       *游戏结束*                       *\n");
    printf("  *  ****************************************************  *\n");
    printf("  *  ***************                      ***************  *\n");
    if (ab == 'A')
        printf("  *  ***********      *恭喜玩家A●赢了!*      ***********  *\n");
    else printf("  *  ***********      *恭喜玩家B○赢了!*      ***********  *\n");
    printf("  *  ***************                      ***************  *\n");
    printf("  *  ****************************************************  *\n");
    printf("  *                     *请按回车返回*                     *\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n  ");
}
void tie()                                              /*打印和棋界面*/
{
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    printf("  *                       *游戏结束*                       *\n");
    printf("  *  ****************************************************  *\n");
    printf("  *  ***************                      ***************  *\n");
    printf("  *  ***********            *和棋*            ***********  *\n");
    printf("  *  ***************                      ***************  *\n");
    printf("  *  ****************************************************  *\n");
    printf("  *                     *请按回车返回*                     *\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n  ");
}
void Game_h(char input)                                 /*悔棋、复棋*/
{
    if (input == '-' && prun -> last != NULL)
    {
        pieces[prun -> data.x][prun -> data.y] = 0;     /*使该位置无子*/
        flag++;
        flag = 2 - flag % 2;                            /*改变下棋状态*/
        countpieces--;                                  /*棋子数减一*/
        prun = prun -> last;                            /*回到上次落棋点*/
        Cx = prun -> data.x * 2;
        Cy = prun -> data.y;
    }
    else if (input == '+' && prun -> next != NULL)
    {
        prun = prun -> next;                            /*恢复棋盘*/
        Cx = prun -> data.x * 2;                        /*更新方标位置*/
        Cy = prun -> data.y;
        pieces[prun -> data.x][prun -> data.y] = flag;
        flag++;                                         /*更新下棋状态*/
        flag = 2 - flag % 2;
        countpieces++;                                  /*棋子数加一*/
    }
}
void regist()                                            /*玩家注册界面*/
{
    FILE *fp1, *fp2;                                    /*定义文件指针*/
    fp1 = fopen("Account_number.txt", "a");                /*打开文件*/
    int j = 0, k, ans = 0, temp = 0;
C:    system("CLS");                                        /*清屏*/
    char c, Account[110], password[2][110], ch, name[110][3];
    printf("\n");                                        /*打造窗口*/
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    printf("  *               ╔══════════╗                 *\n");
    printf("  *   请输入账号:║                    ║                 *\n");
    printf("  *               ╚══════════╝                 *\n");
    printf("  *               ╔══════════╗                 *\n");
    printf("  *   请输入密码:║                    ║                 *\n");
    printf("  *               ╚══════════╝                 *\n");
    printf("  *               ╔══════════╗                 *\n");
    printf("  *   请确认密码:║                    ║                 *\n");
    printf("  *               ╚══════════╝                 *\n");
    printf("  *               ╔══════════╗                 *\n");
    printf("  *   请输入昵称:║                    ║                 *\n");
    printf("  *               ╚══════════╝                 *\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    switch(temp)                                        /*判断哪种情况*/
    {
        case 0: break;
        case 1: printf("  账号不能为空!"); temp = 0; break;
        case 2: printf("  密码的长度不能少于6位!"); temp = 0; break;
        case 3: printf("  请确定两次输入的密码一致!"); temp = 0; break;
        case 4: printf("  该账号已被注册,请重新注册!"); temp = 0; break;
    }
    gotoxy(20, 3);                                        /*使光标跳到指定位置*/
    j = 0;
    while (c = getch(), c != '\r')                        /*输入回车跳出循环*/
    {
        if (c == '*')                                    /*按*返回上次界面*/
            return ;
        if (!(c >= '0' && c <= '9'))                    /*账号为数字*/
        {
            if (c == 8 && j > 0)                        /*判断能否删除*/
            {
                j--;
                if (j > 0)
                    printf("\b\b  \b\b");
                else printf("\b \b"); 
            }
            continue;
        }
        if (j < 10)                                        /*账号的长度不超过10位*/
        {
            Account[j++] = c;
            if (j - 1)
                printf(" ");
            printf("%c", c);
        }
    }
    Account[j] = '\0';
    char account[20];
    fp2 = fopen("Account_number.txt", "r");                /*打开文件*/
    while (~fscanf(fp2, "%s%*s%*s", account))            /*判断该账号是否已注册*/ 
    {
        if (!strcmp(Account, account))
        {
            temp = 4;
            break;
        }
    }
    fclose(fp2);
    if (temp)                                            /*如果已注册,重新注册*/
        goto C;
    for (int i = 0; i < 2; i++)
    {
        j = 0;
        gotoxy(20, 3 * (i + 2));
        while (c = getch(), c != '\r')
        {
            if (c == '*')
                return ;
            if (c == 8 && j > 0)
            {
                printf("\b\b  \b\b");
                j--;
                continue;
            }
            if (c != 8 && j < 10)
            {
                if (!isalpha(c) && !isdigit(c) && c != '.')    /*密码为字母、数字、.*/ 
                    continue;
                password[i][j++] = c;
                printf("●");//·●
            }
        }
        password[i][j] = '\0';
    }
    gotoxy(20, 12);
    j = k = ans = 0;
    while (c = getch(), c != '\r')                        /*输入昵称*/
    {
        if (c == '*')
            return ;
        if (c == 8 && j > 0)
        {
            if (name[j - 1][0] >= 0)                    /*如果删除的非汉字,退一格*/
            {
                printf("\b \b");
                j--;
                ans--;
                continue;
            }
            printf("\b\b  \b\b");                        /*否则退两格*/
            j--;
            ans -= 2;
            continue;
        }
        if (!(c != 8 && ans < 20))
            continue;
        ans++;
        if (c < 0)                                        /*输入为汉字*/
        {
            if (ans != 20 || k != 0)
            {
                name[j][k++] = c;
                printf("%c", c);//·●
                if(k >= 2)
                {
                    name[j][2] = '\0';
                    j++;
                    k = 0;
                }
            }
            else ans--;
            continue;
        }
        if (c != ' ')                                    /*昵称不包含空格*/
        {
            name[j][0] = c;
            name[j++][1] = '\0';
            printf("%c", c);//·●
        }
     }
     if (!strlen(Account))                                /*判断账号是否为空*/
        temp = 1;
    else if (strlen(password[0]) < 6)                    /*判断密码长度是否小于六位*/
        temp = 2;
    else if (strcmp(password[0], password[1]))            /*判断两次输入的密码是否相等*/
        temp = 3;
    else temp = 0;
    if (temp)                                            /*如果出现以上情况,重新注册*/
        goto C;
    name[j][k] = '\0';
    printf("\n\n\n                              ");
    gotoxy(0, 15);
    printf("  恭喜注册成功!\n  ");
    fprintf(fp1, "%s %s ", Account, password[0]);        /*注册成功,把账号密码存下来*/
    if (!j)
        fprintf(fp1, "%s", Account);                    /*如果昵称为空,默认账号为昵称*/
    else for (k = 0; k < j; k++)                        /*保存昵称*/
        fprintf(fp1, "%s", name[k]);
    fprintf(fp1, "\n");                                    /*存入换行*/
    fclose(fp1);                                        /*关闭文件*/
    while (ch = getch(), ch != '\r');                   /*回车返回*/
}
void Log()                                                /*用户界面*/
{
L:    system("CLS");                                        /*清屏*/
    char c;
    printf("\n");                                        /*打造选择玩家界面*/
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    printf("  *                      *请选择玩家*                      *\n");
    printf("  *  ****************************************************  *\n");
    printf("  *  **************  ╔═══╗ ╔═══╗ **************  *\n");
    printf("  *  **********      ║玩家:A║ ║玩家:B║     **********  *\n");
    printf("  *  **************  ╚═══╝ ╚═══╝ **************  *\n");
    printf("  *  ****************************************************  *\n");
    printf("  *                         *返回*                         *\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n  ");
    while (c = getch(), c != 'A' && c != 'B' && c != 'a' && c != 'b' && c != '*');/*输入的是否为这三种字符*/
    if (c == '*')                                        /*按下*返回上个界面*/
        return ;
    if (c == 'a') c = 'A';
    if (c == 'b') c = 'B';
    Log_AB(c);                                            /*进入玩家A界面*/
    goto L;                                                /*重新进入此界面*/
}
void Log_AB(char ab)                                    /*玩家AB界面*/
{
L:    system("CLS");                                        /*清屏*/
    char ch, c;
    printf("\n");                                        /*打造选择界面*/
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    if (ab == 'A')
        printf("  *                     *玩家A请选择:*                     *\n");
    else printf("  *                     *玩家B请选择:*                     *\n");
    printf("  *  ****************************************************  *\n");
    printf("  *  ************  ╔════╗╔════╗  ************  *\n");
    printf("  *  *********     ║I.登录.I║║O.注销.O║     *********  *\n");
    printf("  *  ************  ╚════╝╚════╝  ************  *\n");
    printf("  *  *************     ╔══════╗     *************  *\n");
    printf("  *  *********         ║C.修改密码.C║         *********  *\n");
    printf("  *  *************     ╚══════╝     *************  *\n");
    printf("  *  ****************************************************  *\n");
    printf("  *                         *返回*                         *\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n  ");
    while (c = getch(), c != 'I' && c != 'O' && c != 'C' && c != 'i' && c != 'o' && c != 'c' && c != '*');/*判断是否为以上字符*/
    if (c == '*')
        return ;                                        /*返回上个界面*/
    if (ab == 'A')
    {
        if ((c == 'I' || c == 'i') && log_a)            /*判断玩家A是否已登录*/
        {
            printf("玩家A已登录,请重新选择!");
            while (ch = getch(), ch != '\r');
            goto L;                                        /*如果已登录,重新选择*/
        }
        else if ((c == 'O' || c == 'C' || c == 'o' || c == 'c') && !log_a)/*判断玩家A是否已登录*/
        {
            printf("玩家A还未登录,请前往登录!");
            while (ch = getch(), ch != '\r');
            goto L;                                        /*如果还未登录,重新选择*/
        }
    }
    else
    {
        if ((c == 'I' || c == 'i') && log_b)            /*判断玩家B是否已登录*/
        {
            printf("玩家B已登录,请重新选择!");
            while (ch = getch(), ch != '\r');
            goto L;                                        /*如果已登录,重新选择*/
        }
        else if ((c == 'O' || c == 'C' || c == 'o' || c == 'c') && !log_b)/*判断玩家B是否已登录*/
        {
            printf("玩家B还未登录,请前往登录!");
            while (ch = getch(), ch != '\r');
            goto L;                                        /*如果还未登录,重新选择*/
        }
    }
    switch(c)
    {
        case 'i':
        case 'I': Log_in(ab); break;                    /*进入玩家登录界面*/
        case 'o':
        case 'O': Log_out(ab); break;                    /*进入玩家注销界面*/
        case 'c':
        case 'C': Change(ab); break;                    /*进入密码修改界面*/
    }
}
void Log_in(char ab)                                    /*玩家登录界面*/
{
    FILE *fp1;                                            /*定义文件指针*/
    int j, temp = 0;
C:    system("CLS");                                        /*清屏*/
    char c, Account[110], password[110], ch;
    printf("\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    printf("  *               ╔══════════╗                 *\n");
    printf("  *   请输入账号:║                    ║                 *\n");
    printf("  *               ╚══════════╝                 *\n");
    printf("  *               ╔══════════╗                 *\n");
    printf("  *   请输入密码:║                    ║                 *\n");
    printf("  *               ╚══════════╝                 *\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    switch(temp)                                        /*判断哪种情况*/
    {
        case 0: break;
        case 1: printf("  账号不能为空!"); temp = 0; break;
        case 2: printf("  请确认密码是否正确!"); temp = 0; break;
        case 3: printf("  该账号已登录,请重新登录!"); temp = 0; break;
        case 4: printf("  该账号未被注册,请前往注册!"); temp = 0; break;
    }
    gotoxy(20, 3);
    j = 0;
    while (c = getch(), c != '\r')
    {
        if (c == '*')
            return ;
        if (!(c >= '0' && c <= '9'))                    /*账号为数字*/
        {
            if (c == 8 && j > 0)                        /*如果是Backspace键*/
            {
                j--;
                if (j > 0)
                    printf("\b\b  \b\b");                /*清除数字加空格*/
                else printf("\b \b");                    /*清除数字*/
            }
            continue;
        }
        if (j < 10)
        {
            Account[j++] = c;
            if (j - 1)
                printf(" ");                            /*输出一个空格*/
            printf("%c", c);
        }
    }
    Account[j] = '\0';
    gotoxy(20, 6);
    j = 0;
    while (c = getch(), c != '\r')
    {
        if (c == '*')
            return ;
        if (c == 8 && j > 0)
        {
            printf("\b\b  \b\b");
            j--;
            continue;
        }
        if (c != 8 && j < 10)
        {
            if (!isalpha(c) && !isdigit(c) && c != '.')
                continue;
            password[j++] = c;
            printf("●");//·●
        }
    }
    password[j] = '\0';
    char account[20], pass[20];
    fp1 = fopen("Account_number.txt", "r");
    while (~fscanf(fp1, "%s%s%*s", account, pass))
    {
        if (!strcmp(Account, account))                    /*判断是否注册过*/ 
        {
            temp = 1;
            if (!strcmp(password, pass))                /*判断密码是否正确*/
            {
                temp = 2;
                break;
            }
            break;
        }
    }
    fclose(fp1);
     if (!strlen(Account))                                /*判断账号是否为空*/
        temp = 1;
    else if (temp == 1)                                    /*密码错误*/
        temp = 2;
    else if (!strcmp(log_BAccount, Account) && ab == 'A')/*该账号已登录*/
        temp = 3;
    else if (!strcmp(log_AAccount, Account) && ab == 'B')
        temp = 3;
    else if (!temp)                                        /*该账号未注册*/
        temp = 4;
    else temp = 0;
    if (temp)
        goto C;                                            /*重新登录*/
    if (ab == 'A')
    {
        log_a = 1;
        strcpy(log_AAccount, Account);                    /*保存玩家A的账号*/
    }    
    else
    {
        log_b = 1;
        strcpy(log_BAccount, Account);                    /*保存玩家B的账号*/
    }
    printf("\n\n\n                              ");        /*清除下方显示的提示*/
    gotoxy(0, 9);
    printf("  恭喜登录成功!\n  ");                        /*登录成功*/
    while (ch = getch(), ch != '\r');                   /*回车返回*/
}
void Log_out(char ab)                                    /*玩家注销界面*/
{
    char ch, c;
    system("CLS");                                        /*清屏*/
    printf("\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    printf("  *                      *请确认注销*                      *\n");
    printf("  *  ****************************************************  *\n");
    printf("  *  ************  ╔════╗ ╔════╗ ************  *\n");
    printf("  *  *********     ║Y.确定.Y║ ║N.取消.N║    *********  *\n");
    printf("  *  ************  ╚════╝ ╚════╝ ************  *\n");
    printf("  *  ****************************************************  *\n");
    printf("  *                         *返回*                         *\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n  ");
    while (c = getch(), c != 'Y' && c != 'N' && c != 'y' && c != 'n' && c != '*');/*判断是否为有效输入*/
    if (c == '*' || c == 'N' || c == 'n')
        return ;                                        /*返回上次界面*/
    if (ab == 'A')
    {
        log_a = 0;                                        /*重置玩家信息*/
        memset(log_AAccount, 0, sizeof(log_AAccount));
    }
    else
    {
        log_b = 0;                                        /*重置玩家信息*/
        memset(log_BAccount, 0, sizeof(log_BAccount));
    }
    printf("注销成功!");
    while (ch = getch(), ch != '\r');                   /*回车返回*/
}
void Change(char ab)                                    /*修改密码界面*/
{
    FILE *fp1, *fp2;                                    /*定义文件指针*/
    int j = 0, k, ans = 0, temp = 0;
C:    system("CLS");                                        /*清屏*/
    char c, pass[15], password[2][15], ch, name[15][3], nama[40];
    printf("\n");                                        /*打造窗口*/
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    printf("  *                 ╔══════════╗               *\n");
    printf("  *   请输入旧密码:║                    ║               *\n");
    printf("  *                 ╚══════════╝               *\n");
    printf("  *                 ╔══════════╗               *\n");
    printf("  *   请输入新密码:║                    ║               *\n");
    printf("  *                 ╚══════════╝               *\n");
    printf("  *                 ╔══════════╗               *\n");
    printf("  *   请确认新密码:║                    ║               *\n");
    printf("  *                 ╚══════════╝               *\n");
    printf("  *                 ╔══════════╗               *\n");
    printf("  *   请输入新昵称:║                    ║               *\n");
    printf("  *                 ╚══════════╝               *\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    switch(temp)                                        /*判断哪种情况*/
    {
        case 0: break;
        case 1: printf("  密码错误!"); temp = 0; break;
        case 2: printf("  密码的长度不能少于6位!"); temp = 0; break;
        case 3: printf("  请确定两次输入的新密码一致!"); temp = 0; break;
    }
    gotoxy(22, 3);                                        /*使光标跳到指定位置*/
    j = 0;
    while (c = getch(), c != '\r')
    {
        if (c == '*')
            return ;
        if (c == 8 && j > 0)
        {
            printf("\b\b  \b\b");
            j--;
            continue;
        }
        if (c != 8 && j < 10)
        {
            if (!isalpha(c) && !isdigit(c))                /*密码为字母、数字*/
                continue;
            pass[j++] = c;
            printf("●");//·●
        }
    }
    pass[j] = '\0';
    char account[20], passw[20];                        /*临时账号,密码*/
    fp2 = fopen("Account_number.txt", "r");                /*打开文件*/
    while (~fscanf(fp2, "%s%s%*s", account, passw))
    {
        if (ab == 'A' && !strcmp(log_AAccount, account) || ab == 'B' && !strcmp(log_BAccount, account))
        {
            if (strcmp(passw, pass))                    /*判断输入的密码是否正确*/
                temp = 1;
            break;
        }
    }
    fclose(fp2);
    if (temp)                                            /*如果密码错误,重新输入*/
        goto C;
    for (int i = 0; i < 2; i++)
    {
        j = 0;
        gotoxy(22, 3 * (i + 2));
        while (c = getch(), c != '\r')
        {
            if (c == '*')
                return ;
            if (c == 8 && j > 0)
            {
                printf("\b\b  \b\b");
                j--;
                continue;
            }
            if (c != 8 && j < 10)
            {
                if (!isalpha(c) && !isdigit(c) && c != '.')/*密码为字母、数字、.*/
                    continue;
                password[i][j++] = c;
                printf("●");//·●
            }
        }
        password[i][j] = '\0';
    }
    gotoxy(22, 12);
    j = k = ans = 0;
    while (c = getch(), c != '\r')                        /*输入新昵称*/
    {
        if (c == '*')
            return ;
        if (c == 8 && j > 0)
        {
            if (name[j - 1][0] >= 0)                    /*如果删除的非汉字,退一格*/
            {
                printf("\b \b");
                j--;
                ans--;
                continue;
            }
            printf("\b\b  \b\b");                        /*否则退两格*/
            j--;
            ans -= 2;
            continue;
        }
        if (!(c != 8 && ans < 20))
            continue;
        ans++;
        if (c < 0)                                        /*输入为汉字*/
        {
            if (ans != 20 || k != 0)
            {
                name[j][k++] = c;
                printf("%c", c);//·●
                if(k >= 2)
                {
                    name[j][2] = '\0';
                    j++;
                    k = 0;
                }
            }
            else ans--;
            continue;
        }
        if (c != ' ')                                    /*昵称不包含空格*/
        {
            name[j][0] = c;
            name[j++][1] = '\0';
            printf("%c", c);//·●
        }
     }
    if (strlen(password[0]) < 6)                        /*判断密码长度是否小于六位*/
        temp = 2;
    else if (strcmp(password[0], password[1]))            /*判断两次输入的密码是否相等*/
        temp = 3;
    else temp = 0;
    if (temp)                                            /*如果出现以上情况,重新输入*/
        goto C;
    name[j][k] = '\0';
    printf("\n\n\n                              ");
    gotoxy(0, 15);
    printf("  密码已修改,请重新登录!");
    fp1 = fopen("Account_number.txt1", "w");            /*新建临时文件*/
    fp2 = fopen("Account_number.txt", "r");                /*打开文件*/
    while (~fscanf(fp2, "%s%s%s", account, passw, nama))
    {
        if (ab == 'A' && !strcmp(log_AAccount, account) || ab == 'B' && !strcmp(log_BAccount, account))
        {
            fprintf(fp1, "%s %s ", account, password[0]);/*修改成功,把账号密码存下来*/
            if (!j)
                fprintf(fp1, "%s", account);            /*如果昵称为空,默认账号为昵称*/
            else for (k = 0; k < j; k++)                /*保存昵称*/
                fprintf(fp1, "%s", name[k]);
        }
        else fprintf(fp1, "%s %s %s", account, passw, nama);
        fprintf(fp1, "\n");                                /*存入换行*/
    }
    fclose(fp1);                                        /*关闭文件*/
    fclose(fp2);
    if (ab == 'A')
    {
        log_a = 0;                                        /*重置玩家A信息*/
        memset(log_AAccount, 0, sizeof(log_AAccount));
    }
    else
    {
        log_b = 0;                                        /*重置玩家B信息*/
        memset(log_BAccount, 0, sizeof(log_BAccount));
    }
    remove("Account_number.txt");                        /*删除原文件*/
    rename("Account_number.txt1","Account_number.txt");    /*将临时文件名改为原文件名*/
    while (ch = getch(), ch != '\r');                   /*回车返回*/
}
void pause()                                            /*打印菜单界面*/
{
    system("CLS");                                      /*清屏*/
    printf("\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    printf("  *                        *菜  单*                      * *\n");
    printf("  * ****************************************************** *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                   1.*继续游戏*.1                   * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                    2.*新游戏*.2                    * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                   3.*游戏设置*.3                   * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                   4.*游戏介绍*.4                   * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                    5.*排行榜*.5                    * *\n");
    printf("  * *                                                    * *\n");
    printf("  * *                  0.*返回主菜单*.0                  * *\n");
    printf("  * *                                                    * *\n");
    printf("  * ****************************************************** *\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    printf("  ");
}
void member()                                            /*开发人员介绍界面*/
{
    FILE *fp;                                            /*定义文件指针*/
    char ch, group[5], number[3][15], name[3][15];
    fp = fopen("member.txt", "r");                        /*打开文件*/
    fscanf(fp, "%s", group);
    for (int i = 0; i < 3; i++)
        fscanf(fp, "%s%s", number[i], name[i]);
    system("CLS");                                      /*清屏*/
    printf("\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    printf("  * *              *开  发  人  员  介  绍*              * *\n");
    printf("  * ****************************************************** *\n");
    printf("  * *                                                    * *\n");
    printf("  * *      ╔══╦═══════════════╗      * *\n");
    printf("  * *      ║ 组 ║         成        员         ║      * *\n");
    printf("  * *      ║    ╠═══════╦═══════╣      * *\n");
    printf("  * *      ║ 号 ║    学  号    ║    姓  名    ║      * *\n");
    printf("  * *      ╠══╬═══════╬═══════╣      * *\n");
    printf("  * *      ║ 第 ║ %s ║    %s    ║      * *\n", number[0], name[0]);
    printf("  * *      ║    ╠═══════╬═══════╣      * *\n");
    printf("  * *      ║ %s ║ %s ║    %s    ║      * *\n", group, number[1], name[1]);
    printf("  * *      ║    ╠═══════╬═══════╣      * *\n");
    printf("  * *      ║ 组 ║ %s ║    %s    ║      * *\n", number[2], name[2]);
    printf("  * *      ╚══╩═══════╩═══════╝      * *\n");
    printf("  * *                                                    * *\n");
    printf("  * ****************************************************** *\n");
    printf("  * *              *请  按  回  车  返  回*              * *\n");
    printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
    printf("  ");
    fclose(fp);                                            /*关闭文件*/
    while (ch = getch(), ch != '\r');                   /*回车返回*/
}
void rank(char user, char r_w)                            /*排行榜*/
{
    char ch;
    FILE *fp1, *fp2;
    int t, ans = 0;
    LinkLista p, pre, rear;
    if (user == 'a' && r_w == 'r')                        /*从文件读取信息*/
    {
        fp1 = fopen("rank.txt", "r");
        rear = heada = (LinkLista)malloc(sizeof(Node));
        heada -> next = NULL;
        while (~fscanf(fp1, "%s%s%d%d", ran.account, ran.name, &ran.num, &ran.s_num))
        {
            count++;
            p = (LinkLista)malloc(sizeof(Node));
            p -> data = ran;
            rear -> next = p;
            rear = p;
        }
        rear -> next = NULL;
        fclose(fp1);
        return ;
    }
    if (user == 'r' && r_w == 'r')                        /*查看排行榜*/
    {
        t = 1;
        system("CLS");
        printf("\n");
        printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
        printf("  * *                    *排  行  榜*                    * *\n");
        printf("  * ****************************************************** *\n");
        printf("  * *                                                    * *\n");
        printf("  * *  ╔══╦═════╦══════════╦══╗  * *\n");
        printf("  * *  ║名次║  用  户  ║      昵    称      ║胜场║  * *\n");
        p = heada -> next;
        while (p && t <= 10)                            /*输出前十玩家*/
        {
            char name[20], account[20];
            strcpy(account, p -> data.account);
            strcpy(name, p -> data.name);
            int a, b, c, d;
            a = (10 - strlen(account)) / 2;                /*居中显示*/
            b = 10 - strlen(account) - a;
            c = (20 - strlen(name)) / 2;
            d = 20 - strlen(name) - c;
            printf("  * *  ╠══╬═════╬══════════╬══╣  * *\n");
            printf("  * *  ║ %02d ║", t++);
            while (a--)                                    /*输出前空格*/
                printf(" ");
            printf("%s", account);
            while (b--)
                printf(" ");
            printf("║");
            while (c--)
                printf(" ");
            printf("%s", name);
            while (d--)
                printf(" ");
            printf("║ %02d ║  * *\n", p -> data.num);
            p = p -> next;
        }
        printf("  * *  ╚══╩═════╩══════════╩══╝  * *\n");
        printf("  * *                                                    * *\n");
        printf("  * ****************************************************** *\n");
        printf("  * *              *请  按  回  车  返  回*              * *\n");
        printf("  * * * * * * * * * * * * * * ** * * * * * * * * * * * * * *\n");
        printf("  ");
        while (ch = getch(), ch != '\r');                /*按回车返回*/
        return ;
    }
    ra.num = 0;
    rb.num = 0;
    ra.s_num = 0;
    rb.s_num = 0;
    strcpy(ra.account, log_AAccount);
    strcpy(rb.account, log_BAccount);
    p = heada -> next;
    while (p)
    {
        if (!strcmp(p -> data.account, ra.account))
        {
            ra = p -> data;
            p -> data.s_num++;                            /*从排行榜读取信息*/ 
        }
        if (!strcmp(p -> data.account, rb.account))
        {
            rb = p -> data;
            p -> data.s_num++;
        }
        p = p -> next;
    }
     ra.s_num++;                                            /*总场次加一*/
    rb.s_num++;
    if (user == 'A')                                    /*如果玩家A赢了*/
        ra.num++;                                        /*胜场加一*/
    else rb.num++;
    char account[25], name[25];
    fp1 = fopen("Account_number.txt", "r");
    while (~fscanf(fp1, "%s%*s%s", account, name))
    {
        if (!strcmp(account, ra.account))                /*从账号里读取昵称*/
            strcpy(ra.name, name);
        if (!strcmp(account, rb.account))
            strcpy(rb.name, name);
    }
    fclose(fp1);
    pre = heada;
    while (pre -> next && pre -> next -> data.num >= ra.num)/*链表的插入*/
    {
        if (pre -> next -> data.num == ra.num && ra.num * 1.0 / ra.s_num > pre -> next -> data.num * 1.0 / pre -> next -> data.s_num)
            break;
        pre = pre -> next;
    }
    p = (LinkLista)malloc(sizeof(Node));
    p -> data = ra;
    p -> next = pre -> next;
    pre -> next = p;
    count++;
    p = heada;
    while (p -> next)                                    /*链表的替换*/
    {
        if (!strcmp(p -> next -> data.account, ra.account))
            ans++;
        if (ans == 2)
        {
            count--;
            break;
        }
        p = p -> next;
    }
    if (ans == 2)
        p -> next = p -> next -> next;
    ans = 0;
    pre = heada;
    while (pre -> next && pre -> next -> data.num >= rb.num)/*同上*/
    {
        if (pre -> next -> data.num == rb.num && rb.num * 1.0 / rb.s_num > pre -> next -> data.num * 1.0 / pre -> next -> data.s_num)
            break;
        pre = pre -> next;
    }
    p = (LinkLista)malloc(sizeof(Node));
    p -> data = rb;
    p -> next = pre -> next;
    pre -> next = p;
    count++;
    p = heada;
    while (p -> next)
    {
        if (!strcmp(p -> next -> data.account, rb.account))
            ans++;
        if (ans == 2)
        {
            count--;
            break;
        }
        p = p -> next;
    }
    if (ans == 2)
        p -> next = p -> next -> next;
    fp2 = fopen("rank.txt", "w");            /*读入文件*/
    p = heada -> next;
    while (p)
    {
        fprintf(fp2, "%s %s %d %d\n", p -> data.account, p -> data.name, p -> data.num, p -> data.s_num);
        p = p -> next;
    }
    fclose(fp2);
}
void gotoxy(int x, int y)                                /*将光标移动到坐标为(x,y)的地方*/
{
    CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
    HANDLE hConsoleOut;
    hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE);
    GetConsoleScreenBufferInfo(hConsoleOut,&csbiInfo);
    csbiInfo.dwCursorPosition.X = x;
    csbiInfo.dwCursorPosition.Y = y;
    SetConsoleCursorPosition(hConsoleOut,csbiInfo.dwCursorPosition);
}

下面是程序必须的代码,注意要和代码放在同一个目录下,格式有可能不对,放到文件中就行了。
Account_number.txt:(空)
rank.txt:(空)
introduce.txt:

                            游戏介绍

  一.游戏规则

  1、五子棋是两个人之间进行的竞技活动,由于对黑方白方规则不同,黑棋必须先行.

  2、五子棋专用盘为15×15,五连子的方向为横,竖,斜.

  3、禁手是对局中被判为负的行棋手段.白棋无禁手.

  4、在棋盘上以对局双方均不可能形成五连为和棋.

  5、黑方在落下关键的第五子即形成五连的同时,又形成禁手.此时因黑方已成连五,故禁手失效,黑方胜.

  7、所谓黑方形成禁手,是指黑方一子落下同时形成两个或两个以上的活三,冲四及长连禁手.此时,白方应立即向黑方指出禁手,自然而胜.在本游戏中仅可选择三三禁手.

  二.游戏操作

  1、在本游戏中,首先进入欢迎界面,按"Enter"键可进入游戏.

  2、在游戏中,可按相应的编号进入相应的界面或操作,(此界面按回车返回).

  3、游戏还设定了账号注册、登录、注销、修改密码等操作,账号长度最多10位,密码长度不少于6位,不多于10位.

  4、在本游戏中还设定了排行榜,在游戏中最多列出了前十名的玩家信息.并且只有当黑白玩家都登录账号方可记录玩家此次游戏信息,否则将不记录玩家本次游戏的任何信息.

  5、此游戏可设置游戏的背景颜色和字体颜色,默认黄背景,黑字体,玩家可在游戏设置中设置颜色.

  6、此游戏设置的有禁手规则,默认的为无禁手,玩家可在游戏设置中开启.

  7、黑棋玩家可通过按"w,s,a,d"键进行上下左右操作,按空格键进行下棋.白棋玩家可通过方向键进行操作,按"End"键进行下棋.在这里,实心代表黑棋,圆圈代表白棋.

  8、在下棋中,玩家可按"-"进行悔棋,按"+"进行复棋.按"*"键进入菜单.

  9、在本游戏中,玩家可通过"*"进行某些界面的返回操作.

  10、在游戏中当出现某些提示的时候,可按"Enter"键进行下步操作.

  温馨提示:
      1.窗口设置:窗口大小:宽:62 高:41  缓冲区:宽:62 高:55.
      2.输入昵称最好用电脑自带输入法.
  

member.txt:

xx
xxxxxxxxxxxx xxxxxx
xxxxxxxxxxxx xxxxxx
xxxxxxxxxxxx xxxxxx