C언어소스
Posts
10 posts행렬의 덧셈
#include #define ROWS 3#define COLS 3 int main(void) { int r,c; int A[ROWS][COLS] = {{1,0,0},{0,1,0},{0,0,1}}; int B[ROWS][COLS] = {{1,0,0},{0,1,0},{0,0,1}}; int C[ROWS][COLS]; for(r=0;r
앵그리 공
#include #include int main() { HDC hdc = GetWindowDC(GetForegroundWindow()); int x=30, y=200; int vx=50, vy=-50; int i; MoveToEx(hdc,30,200,NULL); LineTo(hdc,800,200); for (i=0;i<20;i++){ vy=vy+10; x=x+vx; y=y+vy; Ellipse(hdc, x, y, x+10,y+10); Sleep(100); } }
숫자 추측 게임
#include int main() { int a = rand()%100; int b; int c = 0; do{ printf("정답을 추측하여 보시오: "); scanf("%d", &b); c++; if (b >a ) printf("제시한 정수가 높습니다.\n"); if (b < a) printf("제시한 정수가 낮습니다.\n"); } while (b != a); printf("축하합니다. 시도횟수=%d\n", c); return 0; }
while 문을 이용한 제곱값 출력 프로그램
#include int main() { int a; printf("====================\n"); printf(" n n의 제곱\n"); printf("====================\n"); a = 1; while (a


