文章
67
粉丝
207
获赞
188
访问
80.0k
 
#include <iostream>
#include <string.h>
#include <math.h>
#include <algorithm>
using namespace std;
 typedef struct student{
	int a;
	 char b[200];
	 char c[40];
	 int d;
	 struct student *next;
 }student,*Lnode;
	 void find(Lnode s,int aa){
		 while(s!=NULL){
			 if(aa==s->a)
			 {
		    cout << s->a<<' ';
			cout<< s->b<<' ';
			cout<< s->c<<' ';
			cout << s->d ;
			cout <<endl;
			 }
			 s=s->next;
		 }
 }
int main(){
	int n,m;
	while(cin >> n){
		for(int j=0;j<n;j++){
		cin >> m;
		Lnode s=new student;
		Lnode h=s;
		s->next=NULL;
		for(int i=0;i<m;i++){
			
			cin >>s->a;
		
			cin >>s->b;
			cin >>s->c;
			cin >> s->d;
			s->next=new student;
			s=s->next;
			s->next=NULL;
		}
	int ccc;
	
		cin >> ccc;
		find(h,ccc);
	}
	}
return 0;
}
登录后发布评论
暂无评论,来抢沙发