본문 바로가기

Programming15

Alone Study-3 //if문 public class Study3 { public static void main(String [] args) { int a = 5; if(a%2==0) System.out.println(a+ "는 짝수 입니다."); else System.out.println(a+ "는 홀수 입니다."); } } //연속된 if문 public class Study3 { public static void main(String [] args) { int num = 1000; System.out.println(num+"은"); if(0 2012. 12. 26.
Alone Study-2 //수치 계싼에 사용하는 연산자 public class Study2 { public static void main(String [] args) { System.out.println("5+5는"+(5+5)+"입니다."); System.out.println("5-5는"+(5-5)+"입니다."); System.out.println("5*5는"+(5*5)+"입니다."); System.out.println("5/5는"+(5/5)+"입니다."); } } //비교 연산자 public class Study2 { public static void main(String [] args) { int a = 10, b = 20; System.out.println("a = "+a+" b = "+b); System.out.prin.. 2012. 12. 26.
Doublelinkedlist //이중연결리스트 발생 자체만 설정함 #include #include struct Node { int value; struct Node *PL;//왼쪽이동링크로 사용됨 struct Node *PR;//오른쪽이동링크로 사용됨 }; int main(void) { struct Node *Head, *tail, *temp, *temp2, *wtf; wtf=(struct Node *)malloc(sizeof(struct Node)); //동적 메모리 설정 wtf->value = 1; wtf->PL = NULL; wtf->PR = NULL; Head = tail = temp = temp2 = wtf; // 위치 다 똑같음 for (int i = 2 ; i < 13; i++) { //데이터 삽입, 이동을 위한 for.. 2012. 12. 26.
Linkedlist //연결리스트 발생 자체만 구현 #include #include struct Node { int value; struct Node *ptr;//링크로 사용됨 }; int main(void) { struct Node *Head, *tail, *temp, *wtf; wtf=(struct Node *)malloc(sizeof(struct Node)); //동적 메모리 설정 wtf->value = 1; wtf->ptr = NULL; Head = tail = temp = wtf; // 위치 다 똑같음 for (int i = 2 ; i value = .. 2012. 12. 26.