⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dele.cpp

📁 学生管理系统
💻 CPP
字号:
#include"student.h"
void student::dele()
 { 
	 student st[100];
	
	 char h;
	 string na2; 
do{
	 cout<<"请输入要删除学生的姓名:";
	 cin >>na2;
      int o=0; int p,n;bool i=0;
	ifstream f6 ("llz.txt",ios_base::in);		
	while(!f6.eof())
	{
		o++;
	    f6>>st[o].name>>st[o].studentno>>st[o].sex>>st[o].age>>st[o].add>>st[o].tele>>st[o].roomno;
	
	if(na2==st[o].name)  	{ p=o;    i=1;}

	} 
	  n=o;
	  f6.close();

	if(i==1)
	{
	   
	   
	   ofstream f7("llz.txt",ios_base::out); 
	   o=1;
	do
		{ 
		    if(o!=p) 
			{	
			   f7<<st[o].name<<endl<<st[o].studentno<<endl<<st[o].sex<<endl<<st[o].age<<endl<<st[o].add<<endl<<st[o].tele<<endl<<st[o].roomno<<endl;
			   o++;
			}
			else o++;
		 }while (o<n);
		 f7.close();
		 cout<<" 学生"<<na2<<"的信息已删除!"<<endl;
	}

	else cout<<"   对不起,学生 "<<na2<<"尚未被录入!"<<endl;
	cout<<'\n';

		 cout<<"是要继续删除操作吗?y/n:";
		 cin>>h;
		 cout<<'\n';
 }while (h=='y');
	
 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -