C语言程序设计综合作业报告——作业管理系统

1.1系统概要

(1)       进入系统之前,用户输入密码1234,进入,共有3次机会。

(2)       用户根据需要输入(05)或(06)实现不同的功能,若输入其他字符,则显示按键错误,并返回界面让用户重新选择。

(3)       0退出。

 

1.2基本功能要求

1 程序运行时首先给出密码输入菜单:

 

2)用户进入系统后,显示6个或7个菜单的主要功能:

 

3)流程图

 

 

1.3主要知识点

1 使用链表。

2 用多文件管理工程。

3 使用switchcase语句。

4 while语句实现循环。

5 用类实现封装和管理数据。

6 用清屏函数

7 使用文件

 

14系统设计思路与算法

(1)       打开open

 

(2)       添加add

 

(3)       保存save

 

(4)       查找find

 

(5)       显示list

 

(6)       退出exit

清屏前

 

清屏后

 

 

1.5源程序代码

数组程序

/************************************************************************/

/* Student                                                             */

/************************************************************************/

class student

{

public:

            student()

            {

                        Name="noname";

                        Num=0;

                        Ponenum=0;

                        Homework="noname";

            }

            void SetName()

            void SetNum()

            void SetPonenum()

            void SetHomework()

            string GetName()const{return Name;}

            int GetNum()const{return Num;}

            long GetPonenum()const{return Ponenum;}

            string GetHomework()const{return Homework;}

            void Setall();

            void Display();

protected:

private:

            int Num;

            string Name;

            long Ponenum;

            string Homework;

};

/************************************************************************/

/* Setall()函数的实现                                                       */

/************************************************************************/

void student::Setall()

{

            SetNum();

            SetName();

            SetPonenum();

            SetHomework();

}

/************************************************************************/

/* Set~()函数的实现                                                       */

/************************************************************************/

            void SetName()

            {

                        cout<<"请输入学生的名字:";

                        cin>>Name;

 

            }

            void SetNum()

            {

                        cout<<"请输入学生的序号:";

                        cin>>Num;

            }

            void SetPonenum()

            {

                        cout<<"请输入学生的电话号码:";

                        cin>>Ponenum; 

            }

            void SetHomework()

            {

                        cout<<"请输入学生的作业名:";

                        cin>>Homework;

            }

/************************************************************************/

/* Display()函数的实现                                                       */

/************************************************************************/

void student::Display()

{

            cout<<"学生的序号为:"<

            cout<<"学生的名字为:"<

            cout<<"学生的电话号码为:"<

            cout<<"学生的作业为:"<

}

/************************************************************************/

/* 密码界面的实现                                                       */

/************************************************************************/

            for (int n=1;n<=3;n++)

            {

                cout<<"请输入密码:";

                        int code;

                        cin>>code;

                        if (code==1234)

                        {

                                    cout<<"      您成功进入了系统!    "<

                                    cout<<"               ================================"<

                            cout<<"                     欢迎使用作业管理系统!    "<

                            cout<<"               ================================"<

                                    i=1;

                                    break;

                        }

                        else

                                    cout<<"      您输入的不正确,请重新输入!"<

                        i=0;

            }

            if (n==4)

            cout<<"您已输入三次,请下次再试!";

/************************************************************************/

/* 文件管理  保存                                                  */

/************************************************************************/

                                    fout.open("c.txt",ios::app);

                                    fout<<"学生的序号为:"<GetNum()<

                                    fout<<"学生的名字为:"<GetName()<

                                    fout<<"学生的电话号码为:"<GetPonenum()<

                                    fout<<"学生的作业为:"<GetHomework()<

                                    fout<

                                    fout.close();

/************************************************************************/

/* 文件管理  打开                                                 */

/************************************************************************/                                   

                                    fin.open("c.txt");

                                    if(!fin)

                                    {

                                                 cout<<"没有找到您要的文件!"<

                                                 break;

                                    }

                                    while (fin.get(ch))

                                    {

                                                cout<

                                    }

                                    cout<

                                    fin.close();



你可能感兴趣的:(编程实践)