2.h

来自「在matlab中实现ofdm中子载波分配,希望对大家有用!」· C头文件 代码 · 共 57 行

H
57
字号
#include<iostream.h>
#include<string.h>


struct student{
	char name[4];
	char sn[9];
	int cs;
	student * next;
};

student *creat()
{
	student *p1,*p2,*head;    //产生无序链表
	head=0;
	cout<<"input:name,sn,cs:"<<endl;
	char h[9];
	char a[4];
	char b[9];
	int c;
	for(int i=0;i<100;i++)
	{   cin.getline(a,4);
	    cin.getline(h,9);
		cin.getline(b,9);
		cin.getline(h,9);
		cin>>c;
		if(c==-1)break;
		else
		while(c!=-1)
		{
			p1=new student;
			strcpy(p1->name,a);
			strcpy(p1->sn,b);
			p1->cs=c;
			if(head==0)
			{
				head=p1;
				p2=p1;
			}
			else{
			p2->next=p1;p2=p1;}
		    cin.getline(h,9);
			cin.getline(a,4);
			cin.getline(h,9);

			cin.getline(b,9);
			cin.getline(h,9);
			cin>>c;
			if(c==-1)break;
	
			
		}
		break;
	}
	if(head)p2->next=0;
}

⌨️ 快捷键说明

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