Coding 수업정리/CS50

Coding 수업정리/CS50

[컴파일러]makefile 에 대하여

https://kthdev.tistory.com/40 (작성중) smily project 를 작성하고 컴파일까지 완료, 정상작동 확인을 했고 제출까지 했다. [chat gpt는 제출하는 과제에는 사용하지 않았습니다.] 아무리 찾아봐도 나는 분명 helpers.c를 수정했는데, 실행은 colorize를 했다. colorize는 helpers.h를 가지고 있지만 helpers.c는 언급하지 않고, helpers.c는 makefile이라는 파일에서 언급이 되어있었다. makefile이라는게 뭔지 처음봐서, chat gpt에게 함 물어봤다. 파일을 올릴수가 없어서, 내용을 구분해서 다 알려주고 질문했다. 내용이 너무 길어서 질문을 접어둔다. 더보기 ## content of makefile ## colorize:..

Coding 수업정리/CS50

CS50-04-smiley [ 작성중 ]

https://cs50.harvard.edu/x/2023/labs/4/smiley/ https://kthdev.tistory.com/41 [컴파일러]makefile 에 대하여 https://kthdev.tistory.com/40 (작성중) smily project 를 작성하고 컴파일까지 완료, 정상작동 확인을 했고 제출까지 했다. [chat gpt는 제출하는 과제에는 사용하지 않았습니다.] 아무리 찾아봐도 나는 분명 h kthdev.tistory.com Lab 4: Smiley - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. c..

Coding 수업정리/CS50

CS50-03-snackbar (chat gpt 분석)

https://cs50.harvard.edu/x/2023/problems/3/snackbar/ Snackbar - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu 대답, 코드부분은 +더보기를 누르시면 나옵니다! 아래는 내가 작성한, 오류가 나는 코드이다. 더보기 // Practice using structs // Practice writing a linear search function /** * Beach Burger Shack has the following 10 items on their menu..

Coding 수업정리/CS50

CS50-04-license chat gpt 질문으로 이해하는 동적할당과 해제

글이 너무 길어져서, 대답 부분과 코드 부분을 접어두었습니다. 접힌 부분 누르면 내용이 나옵니다. License - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu 이 부분이 너무 이해가 안가는데, 어디서부터 검색을 해야할지 막막했다. 마침 chat gpt가 생각나서 컴공과 친구가 옆에 앉아있다고 생각하고 질문을 해보기로 했다. 연습문제와 개념 부분만 chat gpt에게 물어보고, 제출하는 과제에는 절대 사용하지 않을 예정이다. 우선 아래와 같이 코드를 짜줬는데, 이해가 안가는 부분을 여러 단계에 걸쳐..

Coding 수업정리/CS50

CS50-04-problems - bottomup

https://cs50.harvard.edu/x/2023/problems/4/bottomup/ Bottom Up - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu 외부 파일을 다루는 과정으로 처음 들어가는 연습문제로, 코드 4줄만 추가하면 되는 간단한 문제이다. Bottomup.c // Copies a BMP file #include #include #include "bmp.h" int main(int argc, char *argv[]) { // Ensure proper usage if (argc !..

Coding 수업정리/CS50

CS50-03-psets-runoff[완료]

https://cs50.harvard.edu/x/2023/psets/3/runoff/#tabulate Runoff - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu 아... 5시간 넘게 걸렸다. 길지 않은 코드이지만 오류가 너무 많이 나서 하나씩 잡는데 너무 오래걸렸다. 1. break; 가 while만 뚫는줄 알았는데, for구문도 뚫어버린다는것(1겹만 뚫는다) 그래서 무한루프가 되어 계속 오류가 남. 2. 총 득표수의 50%를 계산할때 이미 탈락한 후보를 제외하지 않아서 부분적 오류가 계속 남아있..

Coding 수업정리/CS50

CS50-03-pset-runoff if(!vote)로 function 소환..

if(!vote)로 function 소환.. 제목처럼 function은 if 조건으로 불러도 내부 함수가 모두 실행된다는걸, 직관적으로는 이해할수가 없었으나, function이라는 친구가, 비교하려고 쳐다보기만해도 갑자기 와서 자기 할일 다하고가는 이상한 친구라고 생각하면 이해가 쉬웠다. 아래 코드에서 vote라는 function을 참인지 아닌지 보려고 부른건데 문제는 vote Function 내부에 투표지 등록하는 함수가 다 들어있어서 저렇게 비교하려고 불러도, 그친구는 일을 다 해버린다는 것이다. 이게 직관적으로 이해는 안가는데, 컴퓨터라는게, 그리고 function이라는 특성을 이해하니 이해가 간다. // Query for each rank for (int j = 0; j < candidate_co..

Coding 수업정리/CS50

CS50-03-algorithm-snackbar(오류 확인 필요)

https://cs50.harvard.edu/x/2023/problems/3/snackbar/ 더보기 strings.h bcmp - compare byte sequences bcopy - copy byte sequence bzero - zero a byte string explicit_bzero - zero a byte string ffs - find first bit set in a word ffsl - find first bit set in a word ffsll - find first bit set in a word index - locate character in string rindex - locate character in string strcasecmp - compare two strings..

Coding 수업정리/CS50

CS50-03-Algorithm-Sections

https://cs50.harvard.edu/x/2023/sections/3/ Week 3 Algorithms - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu 좌측에 괄호 안 부분을 attribute 혹은 field 라고 부른다. + 좌측처럼 candidate를 연속으로 몇번 물어보면서 데이터를 체우게 할 수도 있음 for loop 특정 숫자에 접근하려면 점으로 해서 순서로 특정할수 있음. Recursion 재귀 예시 : Factorial 좌측과 같이 표현 가능함. 좌측보다도 (미완성임) 더 길게 ..

Coding 수업정리/CS50

CS50-02-problem set-substitution

https://cs50.harvard.edu/x/2023/psets/2/substitution/ Substitution - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu 하... 3시간째 작성중인데 하나씩 구현은 되는데 이젠 띄어쓰기를 인식을 못한다.ㅠㅠ 아래는 지금까지 작성한 코드 #include #include #include string substitution(string text, int length, string key); int main(int argc, string argv[]) { //..

Coding 수업정리/CS50

CS50-02-Problem set-Readability

https://cs50.harvard.edu/x/2023/psets/2/readability/ Readability - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu Coleman-Liau index index = 0.0588 * L - 0.296 * S - 15.8 L은 100단어당 들어간 알파벳의 숫자 S는 100단어당 들어간 문장의 숫자. 이 값을 이용하여 입력된 문장의 수준을 판별하는 프로그램 작성. 꽤나 복잡해서 의사코드 작성...을 한다고 했는데 그냥 대충쓴 코드처럼 썼다.. 이거 붙여넣고..

Coding 수업정리/CS50

CS50-02-Lab2-scrabble

https://cs50.harvard.edu/x/2023/labs/2/ Lab 2: Scrabble - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu ascii code 를 활용한 간단한 scrabble game. 아래는 제출한 답안 코드 #include #include #include #include // Points assigned to each letter of the alphabet int POINTS[] = {1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3..

Coding 수업정리/CS50

CS50-02-Section-Command line arguments

https://cs50.harvard.edu/x/2023/sections/2/ Week 2 Arrays - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu #include #include int main(int argc, string argv[]) { for (int i = 1; i < argc; i++) { printf("%c", argv[i][0]); } printf("\n"); } 출력예시 int main(int argc, string argv[]) 를 활용하면, command line argum..

Coding 수업정리/CS50

CS50-02-Section-string의 알파벳 순서 감지

https://cs50.harvard.edu/x/2023/sections/2/ Week 2 Arrays - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu #include #include #include int main (void) { string name = get_string("Type here: "); int length = strlen(name); int count = 0; for (int i = 0; i < length; i++) { if(i != 0) { if(name[i] < name[i-..

Coding 수업정리/CS50

CS50-02-Section-index

https://cs50.harvard.edu/x/2023/sections/2/ Week 2 Arrays - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu #include #include int main (void) { int length; do { length = get_int("Length :"); } while ( length < 1 ); int twice[length]; for (int i = 0, num = 1; i < length; i++, num = num * 2) { twice[i] = ..

Coding 수업정리/CS50

CS50-01-Practice Set-credit(more)

https://cs50.harvard.edu/x/2023/psets/1/credit/ Credit - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu pseudocode (의사코드) 데이터 입력 Number : = (card_number) int d_1 = (card_number % 10000000000000000) / 1000000000000000 int d_3 = (card_number % 100000000000000) / 10000000000000 int d_5 = (card_number % 10..

Coding 수업정리/CS50

CS50-01-Problem Set1-mario-more / for문 연습

https://cs50.harvard.edu/x/2023/psets/1/mario/more/ Mario - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu #include #include int main(void) { int height; do { height = get_int("Height :"); } while ( height > 8 || height < 1); for (int i = 0; i < height; i++) // i++는 { for(int j = i; j < height - 1; j++..

Coding 수업정리/CS50

CS50-01-Practice Problems-half

https://cs50.harvard.edu/x/2023/problems/1/half/ Half - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu 제출한 답안 // Calculate your half of a restaurant bill // Data types, operations, type casting, return value #include #include float half(float bill, float tax, int tip); int main(void) { float bill_amoun..

Coding 수업정리/CS50

CS50-01-Lab 1-Population growth

https://cs50.harvard.edu/x/2023/labs/1/ Lab 1: Population Growth - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu 제출한 답안 #include #include int main(void) { // TODO: Prompt for start size int start_size; do { start_size = get_int("Start size: "); } while ( start_size < 9 ); // TODO: Prompt for end size ..

Coding 수업정리/CS50

CS50-01-Practice problems-prime numbers

https://cs50.harvard.edu/x/2023/problems/1/prime/ Prime - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu 제출한 답안 #include #include bool prime(int number); int main(void) { int min; do { min = get_int("Minimum: "); } while (min = max); for (in..

Coding 수업정리/CS50

CS50-04-Memory

https://cs50.harvard.edu/x/2023/weeks/4/ Week 4 Memory - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu allocate 떼어놓다 할당하다 prompt 촉진하다, 자극하다 16진수 (Hexadecimal) 8bits = 1byte (0x00(0)~FF(255)) binary (2) in bits 0000 0000 1111 1111 decimal (10) 0 255 hexadecimal (16) 00 FF 0 1 2 3 4 5 6 7 8 9 a b c d e ..

Coding 수업정리/CS50

CS50-03-Algorithms

https://cs50.harvard.edu/x/2023/weeks/3/ Week 3 Algorithms - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu linear search For each door from left to right If 50 is behind door Return true Return false //아래와 같이 의사코드(슈도코드) 작성 For i from 0 to n-1 If 50 is behind doors [i] Return true Return false binary s..

Coding 수업정리/CS50

CS50-02-Arrays

https://cs50.harvard.edu/x/2023/weeks/2/ Week 2 Arrays - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu tedious 지루한 exploit 이용하다 obnoxious 불쾌한 stipulate -을 규정하다 cipher 암호 code hello.c (생성) make hello (컴파일) ./hello (실행) 컴파일러 C언어 -> clang 원레 clang -o hello.c hello -lcs50 이지만, 줄여서 make hello 로 표현한다. 컴파일 과..

Coding 수업정리/CS50

CS50-01-C

https://cs50.harvard.edu/x/2023/weeks/1/ Week 1 C - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu CS50-01 C언어 강의에 관한 내용들 parenthesis 괄호 succint 간결한 syntactic 구문론의 increment 증가 terminology 술어, 전문용어 vogue 유행 unwieldily 거추장스럽게 implement 실행하다 충족시키다 syntax 구문 canonical 정식의, 전통적인, 권위있는 consolidate 합병하다 Prep..

Coding 수업정리/CS50

CS50-00-Scratch

https://cs50.harvard.edu/x/2023/weeks/0/ Week 0 Scratch - CS50x 2023 Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. cs50.harvard.edu

kthdev
'Coding 수업정리/CS50' 카테고리의 글 목록