Tài liệu lập trình C for newbie - Chương 1: Nền tảng để bắt đầu!

Xin chào mọi người,
Bộ tài liệu này đã có những phần sau chưa ạ?
Ai có phần sau rồi có thể cho mình xin được không ạ?
Xin cảm ơn rất nhiều! :slight_smile:
p/s:
Đọc xong chương 1 và 2 của bộ này thấy học C/C++ vào nhanh hơn, trước kia mình mất gần 1 năm tìm tài liệu tự học các kiểu mà ko vào được chữ nào :smiley: (Chắc tại máu di chuyển hơi chậm :D) Cảm ơn tác giả và đội ngũ biên dịch rất nhiều:)

3 Likes

cảm ơn chủ thớt rất nhiều, luôn tiện trả bài test program: lớn hơn hay nhỏ hơn

#include <stdio.h>
#include <stdlib.h>
#include<time.h>

int main()
{
    int choilai=1;
    while(choilai!=0)
    {
        int level=0;
        int sotoida=100, sotoithieu=1;
        int sodudoan=0, sobimat=0, solandoan=1;
        int sotoida2=1000, sotoithieu2=1;
        int sodudoan2=0, sobimat2=0, solandoan2=1;
        int sotoida3=10000, sotoithieu3=1;
        int sodudoan3=0, sobimat3=0, solandoan3=1;
        printf("====Level====\n1. De\n2. Trung Binh\n3. Kho");
        printf("\nVui long chon level ban muon: ");
        scanf("%d", &level);

        switch(level)
        {
        case 1:
            srand(time(NULL));
            sobimat=(rand()%(sotoida-sotoithieu+1)+sotoithieu);
            printf("%d", sobimat);
            do
            {
                printf("\nNhap so du doan: ");
                scanf("%d", &sodudoan);
                if(sobimat>sodudoan)
                {
                    printf("\nLon hon!");
                    solandoan++;
                }
                else if(sobimat<sodudoan)
                {
                    printf("\nNho hon!");
                    solandoan++;
                }
                else
                {
                    printf("\n\aBan da doan chinh xac trong %d lan", solandoan);
                }
            }
            while(sobimat!=sodudoan);

            break;
        case 2:
            srand(time(NULL));
            sobimat2=(rand()%(sotoida2-sotoithieu2+1)+sotoithieu2);
            printf("%d", sobimat2);
            do
            {
                printf("\nNhap so du doan: ");
                scanf("%d", &sodudoan2);
                if(sobimat2>sodudoan2)
                {
                    printf("\nLon hon!");
                    solandoan2++;
                }
                else if(sobimat2<sodudoan2)
                {
                    printf("\nNho hon!");
                    solandoan2++;
                }
                else
                {
                    printf("\n\aBan da doan chinh xac trong %d lan", solandoan2);
                }
            }
            while(sobimat2!=sodudoan2);

            break;
        case 3:
            srand(time(NULL));
            sobimat3=(rand()%(sotoida3-sotoithieu3+1)+sotoithieu3);
            printf("%d", sobimat3);
            do
            {
                printf("\nNhap so du doan: ");
                scanf("%d", &sodudoan3);
                if(sobimat3>sodudoan3)
                {
                    printf("\nLon hon!");
                    solandoan3++;
                }
                else if(sobimat3<sodudoan3)
                {
                    printf("\nNho hon!");
                    solandoan3++;
                }
                else
                {
                    printf("\n\aBan da doan chinh xac trong %d lan", solandoan3);
                }
            }
            while(sobimat3!=sodudoan3);


            break;
        default:
            printf("\n\aVui long chon level co san");
            break;
        }
        printf("\nChon 1 de choi tiep va 0 de dung lai: ");
        scanf("%d", &choilai);
    }
}
1 Like

Cám ơn tác giả và các bạn biên dịch. Mình mới đọc xong 2 chương bộ tài liệu này rồi, không biết liệu bộ tài liệu này còn được dịch và up lên không vậy?

1 Like

mong a dịch nốt 2 bộ còn lại, e hóng qua. cảm ơn a đã cho bọn e bộ tài liệu này :smiling_face_with_three_hearts:

2 Likes

Bộ sách này khá hay & thú vị nữa.Anh có thể cho em xin bản full của nó được không ạ.Thank you!

1 Like

a ơi có chương 3 có chưa ạ :grinning::grinning:

1 Like

A post was split to a new topic: Tại sao đã lưu projects rồi mà lần sau mở chương trình codeblocks ở phần bên trái không hiển thị file main đã lưu?

sau khi tham khảo ý kiến các ae mình đã giải dc bài tập bằng hai hàm như sau, ae xem thử nhé:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int taosobimat(int somax,int somin)
{
int sobimat=0;
srand(time(NULL));
sobimat=(rand()%(somax-somin+1))+somin;
return sobimat;
}
void sosanh(int sobimat)
{
    int sodudoan=0;
    int landoan=0;
    while(sodudoan!=sobimat)
    {
        printf("So can tim la gi ?");
        scanf("%d",&sodudoan);
        landoan++;
        if(sodudoan<sobimat)
        {
            printf("Lon hon!\n");
        }

        else if(sodudoan>sobimat)
        {
            printf("Nho hon!\n");
        }
         else
        {
            printf("Chuc mung! Ban da tim ra so bi mat sau %d lan doan",landoan);
        }

    }

}
int main()
{
    int sobimat=0,level=0,choilai=1,mode=0;
    while(choilai!=0)
    {
        printf("Hay chon che do choi: 1.mot nguoi choi   2.hai nguoi choi ");
        scanf("%d",&mode);
        switch(mode)
        {
            case 1:
                printf("Hay chon cap do choi:1.de  2.vua  3.kho ");
                scanf("%d",&level);
                switch(level)
                {
                    case 1:
                        printf("Level 1:hay doan so bi mat nam trong khoang 1 den 100\n\n");
                        sobimat=taosobimat(100,1);
                        sosanh(sobimat);
                        break;
                    case 2:

                        printf("Level 2:hay doan so bi mat nam trong khoang 1 den 1000\n\n");
                        sobimat=taosobimat(1000,1);
                        sosanh(sobimat);
                        break;
                    case 3:
                        printf("Level 3:hay doan so bi mat nam trong khoang 1 den 10000\n\n");
                        sobimat=taosobimat(10000,1);
                        sosanh(sobimat);
                        break;
                    default:
                        printf("Level ban chon khong co!");
                        break;
                }
                break;

            case 2:
                printf("Mot nguoi hay nhap vao so bi mat va nguoi kia doan\n");
                printf("Hay chon cap do choi:1.de  2.vua  3.kho ");
                scanf("%d",&level);
                switch(level)
                {
                    case 1:
                        printf("Nhap so bi mat ");
                        scanf("%d",&sobimat);
                        system("cls");
                        printf("Level 1:hay doan so bi mat nam trong khoang 1 den 100\n\n");
                        sosanh(sobimat);
                        break;
                    case 2:
                        printf("Nhap so bi mat ");
                        scanf("%d",&sobimat);
                        system("cls");
                        printf("Level 2:hay doan so bi mat nam trong khoang 1 den 1000\n\n");
                        sosanh(sobimat);
                        break;
                    case 3:
                        printf("Nhap so bi mat ");
                        scanf("%d",&sobimat);
                        system("cls");
                        printf("Level 3:hay doan so bi mat nam trong khoang 1 den 10000\n\n");
                        sosanh(sobimat);
                        break;
                    default:
                        printf("Level ban chon khong co!");
                        break;
                }
                break;
            default:
                printf("Hay chon chinh xac che do choi!");
                break;

        }
        printf("\nChon 1 de choi tiep va 0 de dung lai ");
        scanf("%d", &choilai);

    }

return 0;

}
2 Likes

2 posts were merged into an existing topic: Tài liệu lập trình C for newbie - Chương 2: Những kỹ thuật nâng cao!

Có chương 3 chưa ad ơii

1 Like

Anh Min nghỉ dài hạn. Chắc không chưa có đâu. :slight_smile:

Bạn chịu khó vô bài gốc (tiếng Pháp) đọc tạm nha. :slight_smile:

5 Likes

Mới đọc chương 1 thôi mà thấy hay quá! Cảm ơn người dịch, biên soạn rất nhiều.

4 Likes

Mình cũng đam mê C/C++ dù chuyên ngành không phải bên lập trình. Nhưng mình rất thích cách “Cho đi những kiến thức” của admin trang web này. Chúc mọi người và gđ luôn khoẻ trong đại dịch Covid.

4 Likes

Counter ++
Cuối dùng printf(sô lần chon %d",counter);
Nhớ khai báo biên cuonter.minh mới hic đc 5 ngày

tài liệu sao không tải đc nhỉ ?

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?