欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

學(xué)生信息管理系統(tǒng)(c++)-創(chuàng)新互聯(lián)

學(xué)生信息管理系統(tǒng)

創(chuàng)新互聯(lián)專注于友誼企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站開發(fā),成都商城網(wǎng)站開發(fā)。友誼網(wǎng)站建設(shè)公司,為友誼等地區(qū)提供建站服務(wù)。全流程按需定制,專業(yè)設(shè)計,全程項目跟蹤,創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務(wù)

?學(xué)生信息管理系統(tǒng),主要為了實現(xiàn)學(xué)生信息的增加、刪除、修改、查找等功能,以下是實現(xiàn)這一功能的相關(guān)代碼。

#include#include#includeusing namespace std;

struct node   //創(chuàng)建一個結(jié)構(gòu)體,學(xué)生的相關(guān)信息
{
	string name;  //學(xué)生姓名
	int number;   //學(xué)生學(xué)號
	string sex;   //學(xué)生性別
	node* next;
};

node* creatList()//不帶頭結(jié)點創(chuàng)建鏈表
{
	node* p, * head;
	int c; //判斷是否繼續(xù)此操作
	head = NULL;
	while(1)
	{
        //創(chuàng)建結(jié)點
		p = new node;
		cout<< "輸入學(xué)生信息:姓名  學(xué)號  性別"<< endl;
		cin >>p->name >>p->number >>p->sex;
		p->next = head;
		head = p;
		cout<< "是否繼續(xù)輸入學(xué)生信息?[1/0]";
		cin >>c;
		if (tolower(c) == 0)
			break;
	}
	return head;
}

void print_List(node* head)  //打印全體學(xué)生的信息
{
	node* p;
	p = head;
	while (p != NULL)
	{
		cout<< p->name<< " "<< p->number<< " "<< p->sex<< endl;
		p = p->next;
	}
}
node* Add_stu(node* head)   //添加學(xué)生
{
	node* p;
	p = new node;
	cout<< "請輸入增添學(xué)生的信息:姓名  學(xué)號  性別"<< endl;
	cin >>p->name >>p->number >>p->sex;
	p->next = head;
	head = p;
	return head;
}

node* Delete_stu(node* head, int dnumber)  //刪除學(xué)生
{
	node* p, * q, * t;
	t = head;
	if (head->number == dnumber)//如果刪除的為第一個結(jié)點
	{
		p = head;
		head = head->next;
		delete p;
		cout<< "刪除成功!"<< endl;
		return head;
	}

	p = head;
	q = head->next;
	while (q != NULL && q->number != dnumber)
	{
		q = q->next;
		p = p->next;
	}
	if (p != NULL&&q!=NULL)
	{
		p->next = q->next;
		delete q;
		cout<< "刪除成功!"<< endl;
		return t;
	}
	cout<< "未找到所需刪除的學(xué)生信息!"<< endl;

}

void Find_stu(node* head, int dnumber)  //查找學(xué)生
{
	node* p;
	p = head;
	while (p != NULL)
	{
		if (p->number == dnumber)
		{
			cout<< "所要查找學(xué)生的相關(guān)信息:"<< endl;
			cout<< p->name<< " "<< p->number<< " "<< p->sex<< endl;
			break;
		}
		else
			p = p->next;
	}
}

void Modify_stu(node* head, int dnumber)   //修改學(xué)生的相關(guān)信息
{
	node* p;
	string aname; int anumber; string asex;
	p = head;
	while (p != NULL)
	{
		if (p->number == dnumber)
		{
			cout<< "輸入修改后的學(xué)生信息"<< endl;
			cin >>aname >>anumber >>asex;
			p->name = aname;
			p->number = anumber;
			p->sex = asex;
			cout<< "所要修改學(xué)生的相關(guān)信息:"<< endl;
			cout<< p->name<< " "<< p->number<< " "<< p->sex<< endl;
			break;
		}
		else
			p = p->next;
	}

}

void main()
{
	int i;int f = 1;
	node *head;
	head = creatList();
	print_List(head);
	cout<< endl;
	cout<< "0、增加新的學(xué)生!"<< endl;
	cout<< "1、刪除學(xué)生信息!"<< endl;
	cout<< "2、查找學(xué)生信息!"<< endl;
	cout<< "3、修改學(xué)生信息!"<< endl;
	cout<< "4、打印學(xué)生信息!"<< endl;
	cout<< "5、退出相關(guān)操作!"<< endl;
	while (f)
	{
		cout<< "請輸入要進行的操作序號:";
		cin >>i;
		switch (i)
		{
		case 0:head=Add_stu(head);
			cout<< "添加成功!"<< endl;
			break;
		case 1: 
		{
			cout<< "請輸入要刪除學(xué)生的相關(guān)信息:姓名  學(xué)號  性別"<< endl;
			string dname; int dnumber; string dsex;
			cin >>dname >>dnumber >>dsex;
			head=Delete_stu(head, dnumber);
			break;
		}
		case 2:
		{
			cout<< "請輸入要查找學(xué)生的學(xué)號:"<< endl;
			int dnumber;
			cin >>dnumber;
			Find_stu(head, dnumber);
		    break;
		}
		case 3:
		{
			cout<< "請輸入要修改學(xué)生的學(xué)號:"<< endl;
			int dnumber;
			cin >>dnumber;
			Find_stu(head, dnumber);
			cout<< "所要修改學(xué)生的相關(guān)信息:"<< endl;
			Modify_stu(head, dnumber);
			cout<< "修改成功!"<< endl;
			break;
		}
		case 4:
			cout<< "打印學(xué)生信息!"<< endl;
			print_List(head);
			break;
		case 5:
			f = 0;
			break;
		default:
			break;
		}
	}
	cout<< "退出!";
	exit(0);
	

}

你是否還在尋找穩(wěn)定的海外服務(wù)器提供商?創(chuàng)新互聯(lián)www.cdcxhl.cn海外機房具備T級流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確流量調(diào)度確保服務(wù)器高可用性,企業(yè)級服務(wù)器適合批量采購,新人活動首月15元起,快前往官網(wǎng)查看詳情吧

文章名稱:學(xué)生信息管理系統(tǒng)(c++)-創(chuàng)新互聯(lián)
網(wǎng)站URL:http://www.chinadenli.net/article14/dhehde.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊網(wǎng)站收錄關(guān)鍵詞優(yōu)化網(wǎng)站策劃小程序開發(fā)企業(yè)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)