Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion homework4.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
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.

$ git add 라는 커멘드로 파일을 track하는데, 이때 track할 필요가 없거나 제외하고 싶은 일부 파일들의 목록을 기록하는 파일이다.
프로젝트의 최상단, 즉 $ git init 한 디렉토리에 .gitignore이라는 파일을 만들고, 관리에서 제외할 파일들의 파일명을 입력하면 된다.


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.

Github상의 내 repository를 타인이 함부로 수정하지 못하도록 push 권한을 부여하기 위한 비밀번호가 SSH key이다.
SSH key는 서버상에 위치하는 공개키(public key)와 클라이언트(내 컴퓨터)상에 위치하는 비공개키(private key)로 이루어져 있으며, SSH 접속을 시도할 때 이 둘이 일치하면 접근을 허가한다.
17 changes: 8 additions & 9 deletions homework4/Source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,24 @@ 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);
cout << arr[i] << " ";
}
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 num = 0;
for (int j = 0; j < arrsize; j++) {
if (arr[j] < arr[i]) num++;
}
output[i] = num;
}

for (int i = 0; i < arrsize; i++) {
cout << output[i] << " ";
Expand Down