[ create a new paste ] login | about

Link: http://codepad.org/nFUfBV0S    [ raw code | fork ]

C++, pasted on Jan 25:
#include <stdio.h>
#include <iostream>

using namespace std;

//범위는 int 범위에서 해결 가능  
//동적으로 배열 2개를 만든다. A 배열과 M 배열.비교하고 바로 출력하는 함수만들어서
//그걸 N번 반복 호출하기.

void compare(int a[], int n, int m){

    bool isit = true;
       
        for(int i = 0; i<n; i++){
            if(a[i] == m){
                cout <<"1\n";
                isit = false;
            }
        }

        if(isit) cout<<"0\n";

}

int main(void){

    int N,M =0;
    cin >> N;

    int * Aarray = new int[N];
    for (int i =0; i<N; i++) cin >> Aarray[i];

    int* Marray= new int[M];
    for (int j= 0; j<M; j++) cin >> Marray[j];

    for (int k =0; k<M ; k++){
        compare(Aarray, N,Marray[k]);
    }

    return 0;
}


Output:
No errors or program output.


Create a new paste based on this one


Comments: