C언어 콘서트 10장 프로그래밍(Programming) 풀이
본문 바로가기

프로그래밍/c언어 콘서트

C언어 콘서트 10장 프로그래밍(Programming) 풀이

 

 

 

2.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
#include <string.h>
#include <conio.h>
 
int main(void)
{
    int i;
    char passward[] = { "1234" };
    char user[4];
 
    while (1) {
        printf("비밀번호를 입력하시오: ");
 
        for (i = 0; i < 4; i++)
        {
            user[i] = getch();
 
            putch('*');
        }
        
        printf("\n");
 
        int result = strcmp(passward, user);
 
        if (result)
            printf("비밀번호 불일치\n");
        else {
            printf("비밀번호 일치");
            break;
        }
 
 
    }
    return 0;
}
cs

3.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdio.h>
#include <string.h>
 
int main(void)
{
    int i, j, k;
    int count[27= { 0, };
    char user[99];
    char ascii[100];
 
 
    printf("입력 문자열: ");
    scanf("%s", user);
 
    int lenth = strlen(user);
 
    for (i = 0; i < 100; i++) {
        ascii[i] = 'a' + i;
        if (ascii[i] == 'z')
            break;
    }
 
    for (i = 0; i <= 26; i++) {
        for (j = 0; j <= lenth; j++)
            if (ascii[i] == user[j])
                count[i]++;
    }
 
    for (k = 1; k < 27; k++) {
        if (count[k] != 0)
            printf("%c문자가 %d번 등장하였음!\n", ascii[k], count[k]);
        
    }
 
    return 0;
 
}
cs

 

7.

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>
#include <string.h>
 
int main(void)
{
    int i;
    char user[100];
    char rCopy[100];
 
    printf("거꾸로 할 문자열 입력: ");
    scanf("%s", user);
 
    int lenth = strlen(user);
 
 
    for (i = 0; i < lenth; i++) {
        rCopy[i] = user[lenth - 1 - i];
    }
 
    rCopy[lenth] = '\0';
 
    printf("%s", rCopy);
 
    return 0;
}
cs

 

9.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <string.h>
 
int main(void)
{
    char user[100];
    int i, count = 1;
 
    printf("단어의 갯수를 셀 문장을 입력하시오: ");
    gets_s(user, 100);
 
    int lenth = strlen(user) - 1;
 
    for (i = 0; i < lenth; i++) {
        if (user[i] == ' ')
            count++;
    }
 
    printf("단어의 갯수: %d", count);
 
    return 0;
}
cs

 

 

11.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>
 
int main(void)
{
    char user;
 
    printf("아스키코드로 바꿀 문자를 입력하시오: ");
    scanf("%c"&user);
 
 
    printf("%c의 아스키 코드: %d", user, user);
 
    return 0;
}
cs

 

13.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdio.h>
#include <string.h>
 
int main(void)
{
    int i, j;
    char user[100];
    char ascii[26];
    int count[26= { 0, };
 
    printf("텍스트를 입력하시오: ");
    gets_s(user, 100);
 
    int lenth = strlen(user);
 
    for (i = 0; i < 26; i++)
        ascii[i] = 'a' + i;
 
 
    for (i = 0; i < 26; i++)
    {
        for (j = 0; j < lenth; j++)
        {
            if (ascii[i] == user[j])
                count[i]++;
        }
 
        printf("%c: %d \n", ascii[i], count[i]);
    }
 
    return 0;
}
cs

 

제가만든 게임입니다! 도움이 되셨다면 평가 한번 부탁드립니다~

https://play.google.com/store/apps/details?id=com.attitudeproblem&hl=en_CA&gl=

 

교관님 몰래 춤추기 – Apps on Google Play

Avoid the instructor's eyes and dance! Please have fun while watching the instructor's fakes. Raise your stats and items to challenge the higher score!

play.google.com