JuliaEG 2016-07-05 02:14 采纳率: 100%
浏览 2015
已采纳

求科研管理系统源代码

实现科研项目基础属性的增加、删除、修改、查找、统计等功能
感激不尽!

  • 写回答

5条回答

  • 唐之风采 2016-07-05 02:57
    关注

    这是一个用链表保存的通讯录,具备信息的增加、删除、修改、查询功能,不知是否符合你的要求。
    //2015/3/12 by LDSD
    #include
    #include
    using namespace std;
    struct node
    {
    char num[15];
    char name[7];
    char phone[12];
    node *next;
    };
    void serch(node *head)
    {
    head=head->next;
    char con;
    char data[15];
    while(1)
    {
    cout<<"1:按学号查询 2:按姓名查询,请选择指令执行操作。\n";
    cin>>con;
    if(con=='1')
    {
    cout<<"请输入学号。"< cin>>data;
    while(head!=NULL)
    {
    if(strcmp(head->num,data)==0)
    {
    cout<num<<'\t'<name<<'\t'<phone<<'\n';break;
    }
    else
    head=head->next;
    }
    if(head==NULL)
    cout<<"未查询到匹配的记录!"< break;
    }
    else if(con=='2')
    {
    cout cin>>data;
    while(head!=NULL)
    {
    if(strcmp(head->name,data)==0)
    {
    cout<num<<'\t'<name<<'\t'<phone<<'\n';break;
    }
    else
    head=head->next;
    }
    if(head==NULL)
    cout<<"未查询到匹配的记录!"< break;
    }
    else
    cout }
    }
    void add(node *head)
    {
    node *new_stu=new node;
    cout cin>>new_stu->num>>new_stu->name>>new_stu->phone;
    new_stu->next=head->next;
    head->next=new_stu;
    }
    void modify(node *head)
    {
    char num[15];
    char name[7];
    char phone[12];
    node *head1=head->next;
    int i=1;
    node *new_stu=new node;
    cout<<"通讯录内容如下,其依次输入编号,学号,姓名,电话号码,以便对信息更新。\n";
    while(head1!=NULL)
    {
    cout<num<<'\t'<name<<'\t'<phone<<'\n';
    head1=head1->next;
    }
    cin>>i>>num>>name>>phone;
    while(i--&&head!=NULL)
    head=head->next;
    if(head==NULL)
    cout<<"你的编号不正确!"< else
    {
    strcpy(head->num,num);
    strcpy(head->name,name);
    strcpy(head->phone,phone);
    }

    }
    void del(node *head)
    {
    node *head1=head->next;
    int i=1;
    cout<<"通讯录内容如下,请输入要删除的编号。\n";
    while(head1!=NULL)
    {
    cout<num<<'\t'<name<<'\t'<phone<<'\n';
    head1=head1->next;
    }
    cin>>i;
    i--;
    while(i--&&head->next!=NULL)
    head=head->next;
    if(head->next==NULL)
    cout<<"你的编号不正确!"< else
    {
    head->next=head->next->next;
    }
    }

    void main()
    {
    char con;
    node *head=new node;
    head->next=NULL;
    while(1)
    {
    cout<<"1:查询 2:添加 3:修改 4:删除,请选择指令执行操作。\n";
    cin>>con;
    if(con=='1')
    serch(head);
    else if(con=='2')
    add(head);
    else if(con=='3')
    modify(head);
    else if(con=='4')
    del(head);
    else
    cout<<"你输入的指令不正确!"<<endl;
    }

    }

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办