View Code of Problem 7

#include <stdio.h>
int main(){
	int T;
	scanf("%d", &T);
	while(T>0){
		int l =0;
		int n;
		scanf("%d",&n);
		int a[n];
		int b[n];
		for(int i=0 ;i<n;i++){
			scanf("%d=%d",&a[i],&b[i]);
		}
		int m;
		scanf("%d",&m);
		for(int k= 0;k<m;k++){
			int x;
			bool _flag = false;
			scanf("%d",&x);
			for(int j=0;j<m;j++){
				if(x==a[j]){
					printf("%d\n",b[j]);
					_flag = true;
				}else if(x == b[j]){
					printf("%d\n",a[j]);
					_flag = true; 
				}	
			}if(_flag == false)printf("UNKNOW");
		}	
		T--;
	}
}
/*
Main.c: In function 'main':
Main.c:18:4: error: unknown type name 'bool'
    bool _flag = false;
    ^
Main.c:18:17: error: 'false' undeclared (first use in this function)
    bool _flag = false;
                 ^
Main.c:18:17: note: each undeclared identifier is reported only once for each function it appears in
Main.c:23:14: error: 'true' undeclared (first use in this function)
      _flag = true;
              ^
Main.c:6:7: warning: unused variable 'l' [-Wunused-variable]
   int l =0;
       ^
*/

Double click to view unformatted code.


Back to problem 7