readstucount.cpp

来自「小学期课程设计」· C++ 代码 · 共 73 行

CPP
73
字号
#include"studentBasicInformation.h"
#include"publicHeadFile.h"


studentInformation	*studentInformation::readStuCount()
{
	static int count,i=1;
    ifstream in; 
	in.open("学生基本信息.txt");
    
	in>>count;
	if(count==0)
	{
		return NULL;
	}
	else
	{
		studentInformation *head,*p1,*p2;
		while(1)
		{
			p1=new studentInformation;
			if(i==1)
			{
				p2=p1;
				head=p1;
			}
			else
			{
				p2->next=p1;
				p2=p1;
			}

//			p1->s_number=count;
 
			in>>p1->s_number;

			in>>p1->s_name;
			  
			in>>p1->s_sex;
			  
			in>>p1->s_gread;
			 
			in>>p1->s_class;
			  
			in>>p1->s_minzhu;
			  
			in>>p1->s_jiguan;
			  
			in>>p1->s_birthday;
			  
			in>>p1->s_zhengzhimianmao;
			  
			in>>p1->s_qinshilou_number;
			  
			in>>p1->s_qinshi_number;
			
			in>>p1->s_qinshi_phoneNumber;
			  
			in>>p1->s_lianxi_phone;
			 
			in>>p1->s_lianxi_address;

			i++;
			count=0;
			in>>count;
			if(count==0)
				break;
			  
		}
		p1->next=NULL;
		return head;
	}
}

⌨️ 快捷键说明

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