3. 다음 프로그램의 출력결과를 쓰시오. #include void swap(int *a, int *b); int main() { int a=10; // 정수 a 선언 및 초기화 int b=20; // 정수 b 선언 및 초기화 swap(&a, &b); // swap 함수 호출 printf("%d %d\n", a, b); // a, b 출력 return 0; } void swap(int *a, int *b) // 두 정수를 교환 { int temp=0; temp = *a; *a = *b; *b = temp; } 답) 20 10 정답 및 해설) 두 정수를 교환(swap)하는 함수 사용 예 입니다. [출처] [2021년 제1회 기사 실기 출제예상 문제] (6과목) 프로그램밍 언어 활용 - 3 (수제비- ..
2. 다음 프로그램의 출력결과를 쓰시오. #include int main() { char sTemp[16] = "Hello Sujebi"; printf("%s", &sTemp[6]); return 0; } 답) Sujebi 해설) sTemp의 7번째( array는 0부터시작) 값인 'S' 부터 문자열의 끝까지 출력합니다. [출처] [2021년 제1회 기사 실기 출제예상 문제] (6과목) 프로그램밍 언어 활용 - 2 (수제비- IT 커뮤니티 (정보처리기사,빅데이터분석기사 등)) | 작성자 보안쌤
1. 다음 프로그램의 출력결과를 쓰시오. #include int main() { char sTemp[16] = "Hello Sujebi"; printf("%s", sTemp); return 0; } } 정답) Hello Sujebi 해설) C언어에는 String이 지원되지 않기 때문에 char array 형태로 문자열을 처리합니다. 문자열 "Hello Sujebi" 를 sTemp라는 char array 변수에 대입 합니다 그 아랫줄 printf() 함수에서 문자열 출력을 위해 "%s" 포맷스트링을 사용하여 sTemp 변수를 출력 합니다 [출처] [2021년 제1회 기사 실기 출제예상 문제] (6과목) 프로그램밍 언어 활용 - 1 (수제비- IT 커뮤니티 (정보처리기사,빅데이터분석기사 등)) | 작..
$('.example-class').on('click', function() { $('.example-class').toggleClass('active'); }); 위 코드는 만약 example-class라는 클래스가 여러 요소에 정의되어 있을 경우 모든 요소에 active 클래스가 추가됩니다. 만약 모든 요소가 아니라 선택된 요소에만 클래스를 추가하고 싶다면 아래 처럼 this 키워드를 사용하면 됩니다. $('.example-class').on('click', function() { $(this).toggleClass('active'); }); this는 CSS 클래스가 아니라 JavaScript 키워드이기 때문에 ' '가 필요 없습니다.
$("#name") //id 명이 name 인 엘리먼트 호출 $(".name") //class 명이 name 인 엘리먼트 호출 $(".name > ul > li ") // class 명이 name 아래에 ul 아래의 li 호출 $(".son").parent() //class 명이 son 인 엘리먼트의 부모(위의 속성) 호출 $(".son").next() //class 명이 son 인 엘리먼트의 다음에 있는 형제속성 호출 (이전에 없으면 호출 안됨) $(".son").prev() //class 명이 son 인 엘리먼트의 이전에 있는 형제속성 호출 (다음에 없으면 호출 안됨) $(".son").siblings() //class 명이 son 인 엘리먼트의 형제속성 모두 호출
jQuery를 사용한 모든 웹페이지는 다음 코드로 시작합니다. $(document).ready()는 문서가 준비되면 매개변수로 넣은 콜백 함수를 실행하라는 의미입니다. jQuery 이벤트 메서드 중 하나입니다. 이 메서드는 비슷한 기능을 수행합니다. 고전 이벤트 모델은 한 번에 하나의 이벤트만 연결할 수 있습니다. 반면에 jQuery의 이벤트 메서드는 표준 이벤트 모델이나 인터넷 익스플로러 이벤트 모델과 마찬가지로 이벤트로 여러개의 함수를 연결할 수 있습니다. 아래의 예제는 실행하게되면 문서가 준비되는 순간 경고창 세 개가 연달아 표시됩니다. $(document).ready() 메서드는 굉장히 많이 사용되므로 jQuery에서는 간단하게 사용할 수 있는 형태를 제공합니다.
css 언어를 통해 html 마크업을 진행하는 기능 입니다. html 상에서 css 언어를 띄어쓰기 없이 작성한 후 탭을 누르면 자동으로 html 마크업이 됩니다. ex) ul>li>a 적용모습 클래스 명도 적용이 가능하다. ex ) ul.nav-wrap>li>a 적용모습 내부에 들어가는 href,src 등도 사용가능하다. ex ) ul>li>a[src="#"] 적용모습 내부에 들어가는 텍스트도 작성이 가능하다. ex ) ul>li>a{안녕하세요} 적용모습 안녕하세요 형제 엘리먼트도 만들수 있다. ex ) ul>li>a{안녕하세요}+div 적용모습 안녕하세요
justify-content: flex-start: 요소들을 컨테이너의 왼쪽으로 정렬합니다. flex-end: 요소들을 컨테이너의 오른쪽으로 정렬합니다. center: 요소들을 컨테이너의 가운데로 정렬합니다. space-between: 요소들 사이에 동일한 간격을 둡니다. space-around: 요소들 주위에 동일한 간격을 둡니다. align-items: flex-start: 요소들을 컨테이너의 꼭대기로 정렬합니다. flex-end: 요소들을 컨테이너의 바닥으로 정렬합니다. center: 요소들을 컨테이너의 세로선 상의 가운데로 정렬합니다. baseline: 요소들을 컨테이너의 시작 위치에 정렬합니다. stretch: 요소들을 컨테이너에 맞도록 늘립니다. flex-direction: row: 요소들을 ..