程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程解疑 >> c++-求科研管理系統源代碼

c++-求科研管理系統源代碼

編輯:編程解疑
求科研管理系統源代碼

實現科研項目基礎屬性的增加、刪除、修改、查找、統計等功能
感激不盡!

最佳回答:


這是一個用鏈表保存的通訊錄,具備信息的增加、刪除、修改、查詢功能,不知是否符合你的要求。
//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;
}

}

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved