분류 전체보기(145)
-
포인터
포인터란:변수를 저장하는 메모리의 주소값 1) 주소연산자(&):포인터를 구해준다. 2) 참조연산자(*):포인터가 가리키는 기억공간 사용한다. 주소 연산자12345int in;printf("in의 포인터: %u",&in); //출력 결과//in의 포인터: 1245048cs 참조 연산자123456int in;*&in = 100;printf("변수 in에 저장된 값: %d", in); //출력 결과//변수 in에 저장된 값: 100cs **값 대입하기** 123int a=10, b=20;b = *&a; //혹은 *&b = *&a//두 가지 방법 모두 가능cs **주소값을 저장하려면** 1234int a;int *ap; //ap는 int형 변수의 시작주소값만 저장할 있다는 뜻ap = &a; //주소값 저장됨 *..
2017.02.18 -
선택정렬, 버블정렬
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556#include#define size 6 void selectSort(int arr[]) { int i, j, index, temp, cnt =0; for (i = 0; i
2017.02.13 -
if~else, switch문
12345678910111213141516#include//짝수를 구하는 함수 bool odd(int n) { return n%2; //true와 1은 동일} int main() { int n; scanf("%d",&n); if (odd(n)) { printf("입력받은 n은 홀수입니다.\n"); }else { printf("입력받은 n은 짝수입니다.\n"); }}cs if~else, switch문 1234567891011121314151617181920212223242526272829303132333435363738394041#include int compare(int a, int b, int c) { int temp; if (a > b) { temp = a; }else { temp = b; } if ..
2017.02.13 -
데이터타입(기본, 파생형)
12345678910111213141516171819202122232425262728293031323334#include int main() { char a=128; //char는 문자/숫자 모두 가질 수 있다. printf("char a : %d \n", a); printf("char a : %c \n", a); unsigned char b = 255; printf("unsigned char b : %d \n", b); char c = 'a'; printf("char c : %c, %d \n", c, c); short int d = 32768; //16비트 printf("short int d : %d \n", d); short e = 32768; //int 생략 가능 printf("short e : %..
2017.02.13 -
파일 여러 개 업로드, 배열로 여러 값 넘기기
순서:1) input 태그 여러 개 넣기2) mhsr.getFiles() 이용해 여러 파일 받은 후, 반복문 돌리기3) list로 이미지 경로 받아와 출력 1) input 태그 여러 개 넣기**업로드할 파일 갯수 만큼 12345678 file: file: Colored by Color Scriptercs 2) mhsr.getFiles() 이용해 여러 파일 받은 후, 반복문 돌리기 123456789101112131415161718192021222324252627282930@RequestMapping(value="/insert.do", method=RequestMethod.POST) public String insert(Product product, Model model, HttpServletRequest ..
2017.02.06 -
8. 회원가입 폼
순서:1) 이름 공백 체크2) ID 중복 체크3) 패스워드 재확인 1) 이름 공백 체크 12345678 이름 : Colored by Color Scriptercs 123456789101112 var hasError = function(thisVal){ //switchClass 만약 바꿀 클래스가 없으면 그냥 더한다. $(thisVal).parents(".has-feedback").switchClass("has-success","has-error"); $(thisVal).siblings(".form-control-feedback").switchClass("glyphicon-ok","glyphicon-remove"); $(thisVal).siblings("input.check").val(0); } var h..
2017.02.02