본문 바로가기

분류 전체보기

(87)
11월 06일 1. struct 응용한 문제풀이 #include #include #include struct Problem //사전정의하는 칸 { char Question[100]; char Case[3][50]; int Answer; int Used; }; struct Problem Problems [] = //문제칸 { {"우유가 아닌 것을 고르시오","딸기우유","초코우유","아메리카노",3,0}, {"학원에 나오지 않는 날을 고르시오","월요일","토요일","화요일",2.0}, {"내가 좋아하는 아이스크림을 고르시오", "바닐라", "녹차", "딸기",1,0} }; int main() { char answer; int Problems_index[3] = {0,1,2}; for (int i=0; iAnswer =..
11월 04일 1. 배열 // 각 출석번호의 학생의 국어점수 #include int main(){ int score[5]={80,10,70,50,100} for (int i=1; i
10월 31일 1. for 문을 이용한 피라미드 작성 #include int main (){ int i,j ; //i= 공 란의 수, j=1줄당 별의 갯수 // 5= 5줄 까지 나타낸다. for (i=1; i
10월 30일 1. 키가 넘으면 못 타는 놀이기구 179cm를 기준으로 잡는다. #include int main(){ int height; printf("당신의 키를 입력해주세요. \n"); printf("이 놀이기구는 180이상은 타지 못합니다. \n"); printf("당신의 키 : "); scanf("%d", &height); if (height
10월 28일 1. for 문을 이용한 구구단 작성 #include #include #include int main() { int x, y ; for (x=1; x
10월 28일 1. Alias 명령어 지정하기 alias 단축명&별칭 = '명령어' example ) alias d='dir' alias h ='history' 2. 삼각형 넓이 구하기 1) sh파일 생성 : gedit triangle.sh 2) 코드 작성 : #!/bin/bash(혹은 sh) echo "밑변의 길이를 입력하세요." read x echo "높이의 길이를 입력하세요." read y ((z=x*y/2)) echo "삼각형의 넓이는 $z 입니다." 3) 터미널에 출력 bash triangle.sh 3. man 명령어 : man 'A(함수)' , 'A' 에 대한 설명을 안내 example ) man ls
10월 24일 1. #DEFINE 응용 - HAP(CAKE) Q : x+y, x*y 로 각각 정의하고, h1, h2 를 10과 곱하여 출력하라 x = 3, y = 4 A : #include #define CAKE1(x,y) x+y #define CAKE2(x,y) (x+y) int main () { int h1 = 0, h2 = 0 ; h1 = 10 * CAKE1(3,4) ; h2 = 10 * CAKE2(3,4) ; printf("h1 = %d , h2 = %d ", h1, h2); return 0; } h1 = 34, h2 = 70 ============================================== 2. define, output, count 응용 Q : output() 을 x로 정의하고, count..