diff --git a/homework4.txt b/homework4.txt index d8160f0..6c678c2 100644 --- a/homework4.txt +++ b/homework4.txt @@ -1,2 +1,5 @@ 1. What is .gitignore? You can write the answer either in Korean or English. -2. Why do Github users need an SSH key pair? (Users can use either SSH key pair or github account info.) Please write down a brief explanation of SSH key. \ No newline at end of file +git의 관리를 받고 싶지 않은 파일들을 .gitignore를 사용하여 설정할 수 있다. .gitignore의 파일들은 git이 tracking 하지 않는다. +2. Why do Github users need an SSH key pair? (Users can use either SSH key pair or github account info.) Please write down a brief explanation of SSH key. +SSH key는 git에서 사용하는 인증 시스템이다. 일반적인 비밀번호보다 높은 보안 수준을 가진다. +git에서의 안전한 통신을 위해 git hub의 사용자들은 SSH key를 필요로한다. \ No newline at end of file diff --git a/homework4/Source.cpp b/homework4/Source.cpp index ab69b66..77a810f 100644 --- a/homework4/Source.cpp +++ b/homework4/Source.cpp @@ -9,7 +9,7 @@ int main() const int arrsize = 10; int* arr = new int[arrsize]; srand((unsigned int)time(NULL)); - cout << "Array arr: " ; + cout << "Array arr: "; for (int i = 0; i < arrsize; i++) { arr[i] = (rand() % 10); @@ -17,17 +17,18 @@ int main() } cout << endl; - //Given the int array arr, generate another int array output. - //whose element indiciates how many elements in arr is smaller than arr[i]. - //For example, if arr is given as [5,8,5,6,8,1,5,9,5,8], - //output should be [1,6,1,5,6,0,1,9,1,6]. - int* output = new int[arrsize]; cout << "Array output: "; - /*********************************** - Implement the code here! - ************************************/ + for (int a = 0; a < arrsize; a++) { + int check = 0; + for (int b = 0; b < arrsize; b++) { + if (arr[a] > arr[b]) { + check++; + } + output[a] = check; + } + } for (int i = 0; i < arrsize; i++) { cout << output[i] << " ";