View Code of Problem 7

#include<stdio.h>
int main(){
	int t;
	scanf("%d",&t);
	int l[t][100000];
	while(t--){
  		int n ;	   
		scanf("%d",&n);	
		for(int i=0;i<n;i++){	
			scanf("%d=%d",&l[t][],&b);
			l[a]=b;
			l[b]=a; 
		}
		int m;
		scanf("%d",&m);
		while(m--){
			int a;
			scanf("%d",&a);
			if(l[a]!=0){
				printf("%d\n",l[a]);
			}else{
				
			 	printf("UNKNOW\n");
			}
		}
	
	}
	return 0;
}
/*
Main.c: In function 'main':
Main.c:10:24: error: expected expression before ']' token
    scanf("%d=%d",&l[t][],&b);
                        ^
Main.c:10:27: error: 'b' undeclared (first use in this function)
    scanf("%d=%d",&l[t][],&b);
                           ^
Main.c:10:27: note: each undeclared identifier is reported only once for each function it appears in
Main.c:11:6: error: 'a' undeclared (first use in this function)
    l[a]=b;
      ^
Main.c:20:5: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int *' [-Wformat=]
     printf("%d\n",l[a]);
     ^
*/

Double click to view unformatted code.


Back to problem 7