From a525818bac059819413d50bd56d59bc931054258 Mon Sep 17 00:00:00 2001 From: yeram Date: Thu, 16 Apr 2020 23:29:30 +0900 Subject: [PATCH 1/2] homework4 answer written --- homework4.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homework4.txt b/homework4.txt index d8160f0..51e62ee 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 +GitÀÇ °ü¸® ´ë»ó¿¡¼­ Á¦¿ÜÇÒ ÆÄÀÏÀÇ ¸ñ·ÏÀ» ÁöÁ¤ÇÒ ¶§ »ç¿ëÇÏ´Â ÆÄÀÏ. +.gitignore¿¡ Ãß°¡ÇÑ È®ÀåÀÚ³ª Æú´õ´Â Git¿¡ ÀÇÇØ ¹«½ÃµÈ´Ù. + +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¸¦ ÀÌ¿ëÇϸé À¯Àú³×ÀÓ°ú ºñ¹Ð¹øÈ£¸¦ ¸Å ¹ø ÀÔ·ÂÇÏÁö ¾Ê°í Github¿¡ Á¢¼ÓÇÒ ¼ö ÀÖ°Ô µÈ´Ù. ±×·¯¸é¼­µµ ³ôÀº ¼öÁØÀÇ º¸¾ÈÀ» º¸ÀåÇÑ´Ù. SSH Key¸¦ ·ÎÄà ±â±â¿¡¼­ »ý¼ºÇϰí À̸¦ µî·ÏÇϸé, SSH Á¢¼ÓÀ» ½ÃµµÇÒ ¶§ SSH Ŭ¶óÀÌ¾ðÆ®°¡ À̸¦ SSH ¼­¹öÀÇ Å°¿Í ºñ±³ÇÏ¿© ÀÏÄ¡Çϸé Á¢¼ÓÀ» Çã°¡ÇÏ´Â ¹æ½ÄÀÌ´Ù. \ No newline at end of file From 2bc26da1b248a467cfa5cb96a65e1220a3870754 Mon Sep 17 00:00:00 2001 From: yeram Date: Thu, 16 Apr 2020 23:53:48 +0900 Subject: [PATCH 2/2] source.cpp code completed --- homework4/Source.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/homework4/Source.cpp b/homework4/Source.cpp index ab69b66..81d032a 100644 --- a/homework4/Source.cpp +++ b/homework4/Source.cpp @@ -1,3 +1,6 @@ +//Lab2_04_Homework +//2018-15376 YeRam Oh + #include #include #include @@ -9,7 +12,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 +20,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 i = 0; i < arrsize; i++) { + int k = 0; + for (int j = 0; j < arrsize; j++) { + if (arr[i] > arr[j]) k++; + } + output[i] = k; + } + for (int i = 0; i < arrsize; i++) { cout << output[i] << " ";