diff --git a/homework4.txt b/homework4.txt index d8160f0..0ce7bc3 100644 --- a/homework4.txt +++ b/homework4.txt @@ -1,2 +1,6 @@ 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 +.gitignore file is a list of files that are not useful so you want to ignore in your working directory, such as backup file, log file, or complilation products. + +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 keys are pair of public key that get shared with services like GitHub, and a private key that is stored only on your computer. When keys are match, you can get access. +SSH key is an alternate way to identify yourself so that you are not required to enter your username and password every time. diff --git a/homework4/2019-16726.zip b/homework4/2019-16726.zip new file mode 100644 index 0000000..cc9ffe7 Binary files /dev/null and b/homework4/2019-16726.zip differ diff --git a/homework4/Source.cpp b/homework4/Source.cpp index ab69b66..a2c7e19 100644 --- a/homework4/Source.cpp +++ b/homework4/Source.cpp @@ -3,7 +3,6 @@ #include using namespace std; - int main() { const int arrsize = 10; @@ -17,17 +16,17 @@ 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 t = 0; t < arrsize; t++) { + int num = 0; + for (int j = 0; j < arrsize; j++) { + if (arr[t] > arr[j]) { + num++; + } + } + output[t] = num; + } for (int i = 0; i < arrsize; i++) { cout << output[i] << " ";