U E D R , A S I H C RSS

새싹교실/2012/start Line

1. /startLine

  • : 가변
  • 가르람 : 민관
  • 람 : 박, , , 민관

2.1. 1-, (2012-03-21)

2.1.1.

  • .
  • wiki 법.
  • 0과 1떻게 글는가(ASCII code).
  • 러가 .
  • 개념과 .
  • , (printf, scanf) (assert).
  • 는가.

2.1.2.

  • 떤 과를 내 르는 것 .

2.1.3.

  • 려고 변 만 말 는데, 려고 무 내 모르는 다 끝나다. 그렇다고 느냐고 면 그것 닌 느낌. 로는 다. 경 따라 다른 방법 모르겠만... 는 것과 가르는 것 다르다는 것 느낀 다. - 민관
  • 가 기다려 ㅋㅋㅋㅋㅋ -
  • 로가 기대대 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ - 박

2.2. 1- (2012-03-22)

2.2.1.

  • .
  • 가 기 는 부들(변, 문) .
  • 는 부들(, call by value, call by reference, 구, )

2.2.2.

  • 가 기 C를 공부 라 따로 과.

2.2.3.

  • 민관 - 가 C문법 는 부 보기, 만들보기, 명, gcc 법. 문과 문법까 는 것 같다. 는데 그래 각보다 다. 로는 겠다.
  • - 는 범 다. 다는 모르는 것들는 것 다.

2.3. 2- (2012-03-26)

2.3.1.

  • 1.
  • .
  • 문(문, 반복문) 문법과 몇몇 될 부들(switch문 break , 반복문 ).
  • .

2.3.2.

  • 된 반복문 기 - 게 반복문 다. -_-

int main()
{
   int num1 , num2 = 1, num3, num4 = 2;

   printf("  \n");
   scanf("%d", &num1);

   num3 = num1 - 1;

   while(num2 <= num1){
      while(num3 < num1){
         printf("*");
         num3++;
      }
      printf("\n");
      num3 = num3 - num4;
      num2 = num2 + 1;
      num4++;
   }

   return 0;
}
  • 달력

2.3.3.

  • - 고 느낌 류가 다는것 로 문법 겠다는것 다.
  • 민관 - (if문법, switch.. for...) 몇몇 들(switch break, 반복문 ..) 그리고 명( 로그래밍, python, 다른 c들) 각보다 는데 1:1라 그런 다. 그리고 각보다 다 는 것 같 보기 다. 내기들 C를 배기가 꽤 는데 로 if문나 for문 문법 가 빠른 것 같 놀랐다. printf, scanf나 기 리기 c 기본문법 다.

2.4. 3- (2012-3-28)

2.4.1.

  • 법.
  • /리 따른 류.
  • .
  • .
  • swap .

2.4.2.

  • 기.

2.4.3.

  • (if문, 반복문)과 배 다. 그리고 를 만드는 법, 는 법 다. 개로는 를 꽤 는 만 겠다. 그리고 드는 른다는 든다. 다른 는데 scope나 내부 다. 그리고 로 printf문 드를 보는데 로 감 것 같다. 로는 다 를 다 는 것 바로 를 나 고민다. 당 다가 까 모르겠다. - 민관
  • 던 것
    - 배, 배
    - 란? , 만드는
    - 대로
    - 것 ......? -

2.5. 3-, (2012-3-28)

2.5.1.

  • , .
  • swap 를 만들보고 문 .
  • 개념, 로그램 메모리.
  • malloc 메모리 당.
  • .

2.5.2.

2.5.3.

  • , 다. 그 swap 를 만들 보고 기를 다. 를 그대로 고 값다는 것 기로 들갔다. 개 고민던 부 는가는데, 무래 call-by-value 기를 를 꺼내는 것 다. 그 로 그림 로그램 메모리 구떻게 되는 기는 방법(call-by-reference) 다. 그리고 malloc 메모리를 는 것과 배 다루다. 개 느낌로는 것 같 기가 느낌 다. 메모리 구를 그림다고 는데, 그래 다. 는 C 런 부 는데 무래 C 래 부 미가 는 것 같다. 그리고 무래 더 구 든다. - 민관
  • swap , 값 변. 그리고 malloc 는 법 . 다 malloc 로그램 구 보고 다. -
  • , , malloc , fflush() , getchar() , 메모리 heap과 stack , (int)a *(*(int a)) , OS 기(DWORD 기를 따라다. 32bit/64bit),
    것 - 디깅, 가변 , 복. -

2.6. 4- (2012-4-2)

2.6.1.

  • swap .
  • 과 값 복(call-by-value).
  • 개념, 로그램 메모리.
  • 문들 대답과 기.

2.6.2.

  • 를 낸다면 C 문법 것 같 C 문법대로 는 만 그렇게까 무리를 낼 다. 떤 과 는 것 만... - 민관

2.6.3.

  • 던 swap 게 복 고 swap 다. 그리고 개념과 는 방법 나갔다. 느끼는 만 call-by-value 를 들고 나는 것 느끼게 되는 것 같다. 그리고 개념 것 같고. 그 단락되고 럼 malloc 는데 고 그 다른 부 다루다 보 다. 그래 가 가 다고 는 만 나가는 것다고 본다. 그리고 둔 목 는 것다. 것들 담겨는 만 C 길러 다. - 민관
  • 대략 개념 - 복달되면 나다.
    .
    메모리 구 + - 변 그 변 + 값 기...데 그림 다. -

2.7. 4- (2012-4-3)

2.7.1.

2.7.2.


가 가는 값과 *, & ( 는데 긴가민가고..) 배..
malloc과 fflush
heap과 stack .
그래 개념만 를 다
그리고 밑... 라뉰ㅋㅋㅋㅋㅋㅋㅋㅋㅋ -

2.7.3.

  • 기 - 배 .

//  
void reverseArr(int **arr, int arrLen);

//  
int arr[10];
reverseArr(&arr, 10);

2.8. 5- (2012-4-4)

2.8.1.

  • malloc .
  • .
  • .

2.8.2.

  • 려면 떻게 는가(malloc ) 메모리 (free ) 기를 다. 그리고 배 기를 는데, 배 결국 된 메모리를 는다는 같고 값 똑같 다는 것 다뤘다. 그 (배)를 를 만드는 법고, 배 때는 반드를 관리 다는 기를 다. - 민관
  • malloc = 배당되는 메모리, 변 따라 당된 값 따라 기는 메모리(변?)
    Pointer = 둘 결국 같다.
    () = 값, |
    든 개념들다. -

2.9. 5- (2012-4-5)

2.9.1.

  • 리뷰.
  • 미, 구 문법(struct 드, ., typedef 드).
  • (changeAge() ).
  • .

2.9.2.

  • 2. 깐 리뷰를 고 그 typedef 다루다. 그리고 구 다루다. 그 typedef int* SOMETHING라는 기를 봤는데, 는 것 같다. int **twoDim twoDim0 malloc 다는 부 것 같다. . 개가 가르 따라려고 다는 것 (*s).age다. ->라 * .로 내 다는 것대로 메모리려고 다는 기다. 다. - 민관
  • , 구 게 되고, 만든 더는 "#"로 다. 또 typedef 다.
※ 감.
  • 는데 1달다. 당 까 농떙 만... 그렇기 군가 가르 로 C를 게 된 것 같다. 런 기 감ㅋ다. -

2.10. 4- (2012-4-5)

2.10.1.

  • malloc .
  • , 구 , typedef 드.
  • .

2.10.2.

  • 를 나갔다. 래 목랑 같 ( )까 나가는 것는데, 랐다. 더 다루 까 다 다 모 다루는 다. - 민관
  • 당(malloc)과 구, 구 , typedef 개념리를 고 그 메모리 그림 다. 또, 구 근 방법 다. 다보고 그 것 같다. -

2.11. 6- (2012-4-9) + 7- (2012-4-9)

2.11.1.

  • 문법.
  • 는가.
  • 보는 (operation).
  • .
  • fopen() 급.

2.11.2.

  • 기를 다. ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ
  • , 모 끝나고 두 말 긴 다. ;;;; 로는 게 구 문법과 게 다룰 는데 기를 기가 많 다른 방러갔. 단 구 (구)과 () 라고 말 는데 그래 다. 런 부 로 경 될 것 같. (관 관리 로그램 ) , 만들 보게 는 게 다. 나 . - 민관

2.12. 8 (2012-5-1) - ,

2.12.1.

  • 문법 복.
  • 로그래밍 러다 - 로그래밍.
  • 로그램 미단()로 개기.
  • 기.
  • 만들기 (isPrime, isPalindromePrime ).

2.12.2.

  • : 를 만드는 . . .
    것 : reverse(number) -
    : 때문 ...미...던 기 고, 가 높 다. C 느껴 다. 공다 보람 느껴다. -
  • 문법과 ' 로그래밍' 다루다. 복 끝나고 로그래밍 부다. 로그램 미단()로 개는 드를 껍데기를 만든 나가는 방다. 개로 내 꼭 다루고 던 내 는 부라 고민 는데, 그래 기는 것 같다. 다로는 가르 나머 것 같다. - 민관

2.12.3.

  • 를 만듭다.
  • 꼭 reverse 나로 만들 다.
    던 내 를 만드는 다고 는 부
    를 만들 다. 들로 나 다.

// 를 뒤 돌려다.
// 123 면 321. 100 면 1. 120 면 21.
int reverse(int number);

2.13. 9(2012-5-9) - ,

2.13.1.

  • callback, event driven과 관련된 기.
  • (char *) 기.
  • 다루기 들(str...).
  • winapi.co.kr

2.13.2.

  • Callback(winapi ) + winapi.co.kr
    과 관련된 5가. + .
    를 봐 그냥 ... 그렇구나 그런 느낌.
    다는 것 보다는 가까 느낌다. -
  • 과 관련된 들과 CallBack 개념과 구 다.
    느낌 들기는 볼 만 다.
    C가 function 로그래밍라는 더 깊 게 된다.
    겠다. -
  • 로 문과 문 다루는 다. 그런데 무래 다. 보고 는 것 다면 보고 데, 그래 다들 그런 것 는 만 그런 는 것 는데 각보다 . 단 명만 기 때문가. 그래 과 관련 를 다룬 것 C char *가 로 보고 그 관련된 () 다는 것 다. - 민관

2.13.3. - 린더 만들기

  • Calender.h - 만들 들. 더 늘려 다.

//  달력 다.
void printCalender(int nameOfDay, int year, int month);
// 달  (nameOfDay)과 막 날  1~endDayOfMonth까 다.
void printDate(int nameOfDay, int endDayOfMonth);
// 달 1     ('\t') 다.
void printFirstTab(int nameOfDay);
// 달력  머리 부(, ,  ,  ) 다.
void printHeader(int year, int month);
// 다  다.
int calculateNameOfNextMonthFirstDay(int nameOfDay, int year, int month);
// 당 달 막 날 다.
int calculateNameOfLastDay(int nameOfDay, int year, int month);
// .
bool isLeapYear(int year);
// 각 달 막 날 를 반다.
// 단 switch-case문 며, 2다.
int endDayOfMonth(int year, int month);
// 각  다. (ex. 0-"Sun", 1-"Mon" ...)
// 단 switch-case문 다.
char *printMonthName(int i);
  • main.cpp

#include <stdio.h>
#include "Calender.h"

int main(int argc, char *args[]) {
	// year (nameOfDay) 는 부.
	int year = 0, nameOfDay = 0;
	printf("Enter the year : ");
	scanf("%d", &year);
	printf("Enter the name of day(0:sun ~ 6:sat) : ");
	scanf("%d", &nameOfDay);

	// 1~12 는 부.
	for ( int month = 1; month <= 12; month++ ) {
		printCalender(nameOfDay, year, month);
		nameOfDay = calculateNameOfNextMonthFirstDay(nameOfDay, year, month);
	}

	return 0;
}
  • sample output - 1 12. ('\t') 면 됩다.

                 January, 2012
-------------------------------------------------
  Sun    Mon    Tue    Wed    Thu    Fri    Sat
   1      2      3      4      5      6      7
   8      9     10     11     12     13     14
  15     16     17     18     19     20     21
  22     23     24     25     26     27     28
  29     30     31

2.13.4.

  • strcat(str1, str2)를 str1 는데 는가.
    People p; strcat 다. p를 (People p = {0};)
    p.name 기 값는 것 같다. 그래 strcat 면 p.name 뒷부(p.name99 뒷부) "길동" 내다.
    p를 나 memset(p.name, 0, sizeof(char)*100); 는 방법 다.


#include <stdio.h>
#include <string.h>

typedef struct People{
	char gender;
	int age;
	char name[100];
	char real_name[100];
} People;

int main()
{
	char str1[100] = "abc";
	char str2[100] = "aaa";

	People p;
	strcat(p.name, "길동");

	strcat(str1, str2);

	printf("%s", str1);

	getchar();
	return 0;
}

2.14. 10(2012-5-22) - ,

2.14.1.

  • 더 다루 보고 다는 기가
    를 만들다.
  • 대로 로그램 만들 본다는 것 같다.
    그리고 addAccount() deleteAccount()는 가 될 것다.

Account.h
#include <stdio.h>

typedef struct Account {
	char *name;
	int money;
} Account;

typedef struct AccountArray {
	struct Account **accounts;
	int currentAccountNumber;
	int maxLength; // 배  때는 길를 관리는 구를 만들 다.
} AccountArray;

Account *createAccount(char *name); // Account 깔끔 는 문 다.
AccountArray *createAccountArray(int maxLength);
void addAccount(AccountArray *accountArray, char *name);
bool isFull(AccountArray *accountArray); // 배떻게 까??????
AccountArray *extendArray(AccountArray *before); // 다     다.
void deleteAccount(AccountArray *accountArray, char *name); // 배   ?  구멍만 뻥 뚫두면 되나?
void deposit(AccountArray *accountArray, char *name, int money); // accountArray 내부  .
void withdraw(AccountArray *accountArray, char *name, int money);

void addAccountMenu();
void deleteAccountMenu();
void depositMenu();
void withdrawMenu();

main.cpp
#include <stdio.h>

#include "Account.h"

int main(int argc, char *argv[]) {
    int select = 0;
	//  .

    while ( true ) {
        printf("select menu : ");
		printf("1:  가\n");
		printf("2:  \n");
		printf("3: \n");
		printf("4: \n");
        scanf("%d", &select);

        switch ( select ) {
		case 1:
			addAccountMenu();
			break;
		case 2:
			deleteAccountMenu();
			break;
		case 3:
			depositMenu();			
			break;
		case 4:
			withdrawMenu();
			break;
                default:
                        break;
		}
    }

	return 0;
}

2.14.2.

2.15. 11(2012-5-23) - ,

2.15.1.

////////////////////////////////////// 기본 , 기본  + 
char a; // a ? 1. 메모리 a 그려보기.
a = ?? //   보기.
int b; // b ? 1. 메모리 b 그려보기.
b = ?? //   보기.

char c[10]; // c ?, 1. 과 동 0  보기., 2. 반복문    보기., 3. c[0] ?
char *d; // d ? char 10개 과 동   보기.

// c d를 각각 메모리 그려보기. .


??? // []를  c     보기.
??? // 가능 방법로 d     보기.
??? // 가능 방법로 c     보기.
// array[0] == *(array + 0) 배 라는 는 동  다.



////////////////////////////////////////   ,    + 
Person p; // p ? 1. 메모리 p 그려보기.
??? // p 보기.

Person pArr[10]; // pArr ? 1. 메모리 pArr 그려보기.
??? // pArr 0 보기

Person *p2; // p2 ? 1. 메모리 p2 그려보기.
??? // p2   보기.
??? // p2 보기.



Person *ppa[10] // ppa ? 1. 메모리 ppa 그려보기., 2. ppa[0] ? 3. ppa[0]   보기. 4. ppa[0]  보기.

Person **ppb // ppb ? 1. 메모리 ppb 그려보기., 2. ppb[0] ? 3. ppb[0]   보기., 4. ppb[0]  보기.

2.15.2.

2.16. 12(2012-7-19)

2.16.1.

  • AccountArray 관련된 들 만들기.
  • createAccount(char *name) Account *를 반는가.

Account makeAccount(char *name) {
	Account account;
	account.money = 0;
	account.name = (char *)malloc(sizeof(char) * (strlen(name)+1));
	strcpy(account.name, name);

	return account;
}

void addMoney(Account account, int money) {
	account.money += money;
}
그냥 Account를 반게 만든 다 보면 다.
Account를 그냥 게 되면 call-by-value로 Account고 money를 기 때문
본 Account무런 변다.
  • extendArray .

2.17. 13(2012-7-20)

2.17.1.


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef int Data;

typedef struct Node {
    Data data;
    Node *nextNode;
} Node;

typedef struct LinkedList {
    int length;
    Node *headNode;
} LinkedList;

LinkedList *createList();
Node *createNode(Data data);
void deleteList(LinkedList *linkedList); // LinkedList까 .
void addData(LinkedList *linkedList, Data data); // LinkedList 맨 뒤 Data를 가 Node 가.
void removeData(LinkedList *linkedList, Data data); // 는 Data를 가 Node .
Node *getData(LinkedList *linkedList, int position); // 는 index를 가 Node를 반.
void clearList(LinkedList *linkedList); // LinkedList Node들 .
void printList(LinkedLIst *linkedList);

2.17.2. 드들






#include "LL.h"

LinkedList *createList(){
	LinkedList *res;
	res = (LinkedList *)malloc( sizeof(LinkedList) );
	(*res).headNode = NULL;
	(*res).length = 0;	
	return res;
}
Node *createNode(Data data){
	Node *res;
	res = (Node *)malloc( sizeof(Node) );
	(*res).data = 0;
	(*res).nextNode = NULL;
	return res;
}
void deleteList(LinkedList *linkedList){
	clearList(linkedList);
	free(linkedList);
}
void addData(LinkedList *linkedList, Data data){
	Node *node = createNode( data );
	Node *temp = linkedList->headNode;
	for(;temp->nextNode != NULL;){
		temp = temp->nextNode;
	}
	temp->nextNode = node;
}
void removeData(LinkedList *linkedList, Data data){
	int onoff = 0;																		//for duty of switch
	Node *remove = linkedList->headNode;
	if( remove->data == data ){
		free( remove );																	//If the object is headNode
		onoff = 1;
	}
	if( onoff == 0 && remove->nextNode->data == data ){
		free( remove->nextNode );														//If the object is the nextNode of headNode
		onoff = 1;
	}
	for(; onoff == 0 && remove->nextNode->data != data;){								//...
		remove = remove->nextNode;
	}
	remove->nextNode = remove->nextNode->nextNode;										//	remove   remove-n   remove-n-n
	free(remove->nextNode);																//	remove ~ remove-n-n , free remove-n
}
Node *getData(LinkedList *linkedList, int position){
	Node *get = linkedList->headNode;
	for( int i = 0 ; i < position ; i++ ){
		get = get->nextNode;
	}
	return get;
}
void clearList(LinkedList *linkedList) {
	Node *now = (*linkedList).headNode;
	Node *next;
	for( ; (*now).nextNode != NULL ; ){	//now 는동 반복
		next = (*now).nextNode;			//next는 now
		free( now );					//now를 free
		now = next;						//next를 now로 당김
	}
	free( now );						//now를 free
}
int lengthOf(LinkedList *linkedList){
	int length = 0;
	Node *temp = linkedList->headNode;
	for( ; temp->nextNode != NULL ; length++ ){
		temp = temp->nextNode;
	}
	return length;
}
void printList(LinkedList *linkedList){
	Node *temp = linkedList->headNode;
	for( ; temp->nextNode != NULL ; ){
		printf("%d\t", temp->data);
		temp = temp->nextNode;
	}
	printf("\n");
}

2.17.3.

  • 더미 노드 , .

2.18. 2012-7-30

2.18.1.

int main() {
	Stack *stack = createStack();
	assert(stack->elementNumber == 0);
	assert(stack->head == NULL);

	push(stack, 10);
	assert(stack->elementNumber == 1);
	assert(peek(stack)->data == 10);

	push(stack, 20);
	assert(stack->elementNumber == 2);
	assert(peek(stack)->data == 20);

	assert(pop(stack)->data == 20);
	assert(stack->elementNumber == 1);

	Node *result = pop(stack);
	assert(result->data == 10);
	assert(isEmpty(stack));

	return 0;
}

2.19. 2012-8-2

2.19.1.

  • Map in C - 떻게든 내를 내 보려고 다. 드를 보고 민관 볼 것.


Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:48
Processing time 0.0851 sec