wow
This commit is contained in:
parent
14647b72e2
commit
7f76e58e1e
10 changed files with 150 additions and 5 deletions
|
|
@ -12,10 +12,5 @@ int main() {
|
|||
|
||||
printf("char: %zu bytes\n", sizeof(char));
|
||||
|
||||
char ch = 'A';
|
||||
printf("\n%c %d", ch, ch);
|
||||
ch += 32;
|
||||
printf("\n%c %d", ch, ch);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
11
02/02_55p.c
Normal file
11
02/02_55p.c
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
char str;
|
||||
printf("영문자 입력 : ");
|
||||
scanf("%c", &str);
|
||||
|
||||
printf("입력한 문자는 '%c'이고\n", str);
|
||||
printf("ASCII 코드 값은 %d입니다.\n", str);
|
||||
return 0;
|
||||
}
|
||||
21
02/02_56p.c
Normal file
21
02/02_56p.c
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main() {
|
||||
char name[100];
|
||||
char school[100];
|
||||
char department[100];
|
||||
|
||||
printf("이름 : ");
|
||||
scanf("%s", name);
|
||||
getchar(); // consume newline
|
||||
printf("학교 : ");
|
||||
fgets(school, sizeof(school), stdin);
|
||||
school[strcspn(school, "\n")] = '\0'; // remove newline from school
|
||||
printf("학과 : ");
|
||||
scanf("%s", department);
|
||||
|
||||
printf("%s\n%s\n%s님 안녕하세요?\n", school, department, name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
17
02/02_57p.c
Normal file
17
02/02_57p.c
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
int A;
|
||||
int B;
|
||||
|
||||
printf("정수 A : ");
|
||||
scanf("%d", &A);
|
||||
printf("정수 B : ");
|
||||
scanf("%d", &B);
|
||||
|
||||
printf("정수 A와 B의\n");
|
||||
printf("합 : %d\n", A + B);
|
||||
printf("평균 : %.f\n", (A + B) / 2.0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
13
02/02_60p.c
Normal file
13
02/02_60p.c
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
char some[20];
|
||||
printf("문자열 입력 : ");
|
||||
scanf("%s", some);
|
||||
printf("[출력결과]\n");
|
||||
for (int i = 0; i < 4; i++) {
|
||||
printf("%c", some[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
15
02/02_61p.c
Normal file
15
02/02_61p.c
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
int A, B;
|
||||
|
||||
printf("정수 A : ");
|
||||
scanf("%d", &A);
|
||||
printf("정수 B : ");
|
||||
scanf("%d", &B);
|
||||
|
||||
printf("정수 A / B 결과 출력(지수형)\n");
|
||||
printf("%.2e\n", (double)A / B);
|
||||
|
||||
return 0;
|
||||
}
|
||||
11
02/02_62p.c
Normal file
11
02/02_62p.c
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
double yard;
|
||||
printf("야드 (yard) 입력 : ");
|
||||
scanf("%lf", &yard);
|
||||
printf("[출력결과]\n");
|
||||
printf("%.1lfyard=>%.1lfcm\n", yard, yard * 91.44);
|
||||
|
||||
return 0;
|
||||
}
|
||||
15
02/02_63p.c
Normal file
15
02/02_63p.c
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main() {
|
||||
int num;
|
||||
|
||||
printf("10진수 입력 : ");
|
||||
scanf("%d", &num);
|
||||
|
||||
printf("\n[출력결과]\n\n");
|
||||
printf("1. 8진수 : %o\n", num);
|
||||
printf("2. 16진수 : %X\n", num);
|
||||
|
||||
return 0;
|
||||
}
|
||||
17
02/02_68p.c
Normal file
17
02/02_68p.c
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main() {
|
||||
int a = 1;
|
||||
int b = 2;
|
||||
|
||||
printf("a: %d b: %d\n", a, b);
|
||||
|
||||
int temp = a;
|
||||
a = b;
|
||||
b = temp;
|
||||
|
||||
printf("a: %d b: %d", a, b);
|
||||
|
||||
return 0;
|
||||
}
|
||||
30
02/02_69p.c
Normal file
30
02/02_69p.c
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define C 1046.502
|
||||
#define D 1108.731
|
||||
#define E 1318.510
|
||||
#define F 1396.913
|
||||
#define G 1567.982
|
||||
#define A 1760.000
|
||||
#define B 1975.533
|
||||
|
||||
int main() {
|
||||
int notes[] = {
|
||||
G, G, A, A, G, G, E, G, G, E, E, D,
|
||||
G, G, A, A, G, G, E, G, E, D, E, C
|
||||
};
|
||||
int noteDelays[] = {
|
||||
200, 200, 200, 200, 200, 200, 400, 200, 200, 200, 200, 500,
|
||||
200, 200, 200, 200, 200, 200, 400, 200, 200, 200, 200, 500
|
||||
};
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (int)(sizeof(notes) / sizeof(notes[0])); i++) {
|
||||
Beep(notes[i], 500);
|
||||
Sleep(noteDelays[i]);
|
||||
}
|
||||
|
||||
system("pause");
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue