Word guessing game project कैसे बनाये in C language | with source code

 हेलो दोस्तों !

आज की इस word guessing game project कैसे बनाये in C language | with source code  पोस्ट में हम word guessing game का project C programming की मदद से बनाना सीखेंगे। तो दोस्तों अगर आप इस प्रोजेक्ट को अच्छी तरह समझना चाहते है तो इस पोस्ट को अंत तक जरूर पढ़े। 


इस पोस्ट के मुख्य टॉपिक्स निन्म है -

  1. word guessing game क्या है ?
  2. word guessing game project कैसे work करेगा।
  3. word guessing game project का source code .
  4. word guessing game project video.

1. word guessing game क्या है :-

दोस्तों इस प्रोजेक्ट को अच्छी तरह समझने के लिए हमें थोड़ा इस गेम के बारे में जानना पड़ेगा। तभी हम इस प्रोजेक्ट को अच्छी तरह समझ पाएंगे। 


word guessing game project in C language hindi



वैसे तो सभी को पता होता है की word guessing गेम क्या होता है लेकिन जो लोग नहीं जानते है की वर्ड गेस्सिंग गेम क्या होता है तो हम बता दें की वर्ड गेस्सिंग एक ऐसा गेम होता है जिसमें आपके किसी वर्ड को गेस करना होगा। और आप वर्ड सही गेस करते है तो आप गेम को जीत जाते है। 

इस गेम प्रोजेक्ट में आपको कम-से-कम 5 वर्ड सही गेस करने होंगे। तभी आप इस गेम को जीत पाएंगे। इस गेम में कुछ इस प्रकार से वर्ड को गेस करना होता है। 

W_n_o_s = Windows
O_a_g_ = Orange

2. word guessing game project कैसे work करेगा :- 

दोस्तों अब हम यह समझ लेते है की यह प्रोजेक्ट कैसे वर्क करेगा। 

दोस्तों जैसा की हमने ऊपर बताया है की वर्ड गेस्सिंग गेम ऐसा गेम होता है जिसमें आपको वर्ड्स को गेस करना होता है। तो दोस्तों इस गेम प्रोजेक्ट को खेलने की कुछ नियम (rules) है जिसको हमने main फंक्शन के अंदर कोड किया है। इसका मतलब है की जो इस गेम को खेलने के कुछ रूल्स है उनकी कोडिंग main फंक्शन के अंदर की गई है। 

इसके बाद हमारा गेम start होगा और इस गेम को स्टार्ट करने की कोडिंग हमने इस startGame फंक्शन के अंदर की गई है। इसी फंक्शन की मदद से यह प्रोजेक्ट गेम को स्टार्ट करने का काम करेगा। जब गेम स्टार्ट होगा तो आपको एक वर्ड गेस करने के लिए दिया जायेगा। जिसके कुछ लेटर नहीं होंगे। 

जब आप वर्ड को गेस करेंगे तो आपके गेस किये गए वर्ड को चेक करने के लिए wordCheck फंक्शन का यूज़ होगा। क्योंकि इसी फंक्शन के अंदर ही हमने गेस किये गए वर्ड को चेक करने की कोडिंग की है। की गेस किया गया वर्ड सही है या गलत है। 

इसके बाद जब आप सभी वर्ड को गेस कर लेते है तो आपके सामने गेम का रिजल्ट शो किया जायेगा। जिसकी कोडिंग showResult फंक्शन के अंदर की गई है। इसी फंक्शन की मदद से यह प्रोजेक्ट आपके सामने रिजल्ट शो करेगा की आपने गेम को जीता है या हारा है। इस प्रकार यह पूरा प्रोजेक्ट वर्क करेगा। 

3. word guessing game project का source code :- 

तो दोस्तों अब हम इस game project का source code देख लेते है। 

project source code :-


#include< stdio.h >
#include< string.h >
#include< stdlib.h >
char *phoneBrand[]={"Nokia","Sumsung","Apple","Oppo","Micromax","Intex"};
int chance=5,correctWord=0;
void showResult()
{
    if (correctWord>=5)
    {
        printf("\n**********************************************\n");
        printf("|        Congratulation! You won the Game    |\n");
        printf("|        You have guessed %d words correctly  |\n",correctWord);
        printf("**********************************************\n\n");
    }else
    {
        printf("\n**********************************************\n");
        printf("|        Sorry! You lose the Game            |\n");
        printf("|        You have guessed %d words correctly  |\n",correctWord);
        printf("**********************************************\n\n");
    }   
}
void checkWord(int i,char *guessWord)
{
    if (0==strcmp(guessWord,phoneBrand[i]))
    {
        printf("Correct Guess\n");
        correctWord++;
    }else
    {
        printf("Wrong Guess\n");
        chance--;
    }
}
void startGame()
{
    char guessWord[15];
    printf("\nYou have only %d chance\n",chance);
    printf("Total correct word %d\n",correctWord);
    printf("Guess which phone brand name is this\n");
    printf(" N_k_a: ");
    fflush(stdin);
    gets(guessWord);
    checkWord(0,guessWord);
    printf("\nYou have only %d chance\n",chance);
    printf("Total correct word %d\n",correctWord);
    printf("Guess which phone brand name is this\n");
    printf(" S_m_u_g: ");
    fflush(stdin);
    gets(guessWord);
    checkWord(1,guessWord);
    printf("\nYou have only %d chance\n",chance);
    printf("Total correct word %d\n",correctWord);
    printf("Guess which phone brand name is this\n");
    printf(" A_p_e: ");
    fflush(stdin);
    gets(guessWord);
    checkWord(2,guessWord);
    printf("\nYou have only %d chance\n",chance);
    printf("Total correct word %d\n",correctWord);
    printf("Guess which phone brand name is this\n");
    printf(" _p_o: ");
    fflush(stdin);
    gets(guessWord);
    checkWord(3,guessWord);
    printf("\nYou have only %d chance\n",chance);
    printf("Total correct word %d\n",correctWord);
    printf("Guess which phone brand name is this\n");
    printf(" M_c_om_x: ");
    fflush(stdin);
    gets(guessWord);
    checkWord(4,guessWord);
    printf("\nYou have only %d chance\n",chance);
    printf("Total correct word %d\n",correctWord);
    printf("Guess which phone brand name is this\n");
    printf(" _n_ex: ");
    fflush(stdin);
    gets(guessWord);
    checkWord(5,guessWord);
    showResult();
}
void main()
{
    char ch;
    printf("\n*******Welcome to word guessing Game*******\n\n");
    printf("Here are few rules of this Game\n");
    printf("1.Total guess word is 6\n");
    printf("2.You need to guess 5 word correctly to win the Game\n");
    printf("3.You have 5 chance to win the Game\n");
    printf("4.Every wrong guess you lose 1 chance\n");
    printf("For start Game press Y otherwise press N\n");
    fflush(stdin);
    ch=getchar();
    if (ch=='Y'||ch=='y')
    {
        startGame();
    }else
    {
        exit(0);
    }    
}

project output :-


*******Welcome to word guessing Game*******

Here are few rules of this Game
1.Total guess word is 6
2.You need to guess 5 word correctly to win the Game
3.You have 5 chance to win the Game
4.Every wrong guess you lose 1 chance
For start Game press Y otherwise press N
y

You have only 5 chance
Total correct word 0
Guess which phone brand name is this
 N_k_a: Nokia
Correct Guess

You have only 5 chance
Total correct word 1
Guess which phone brand name is this
 S_m_u_g: Sumsung
Correct Guess

You have only 5 chance
Total correct word 2
Guess which phone brand name is this
 A_p_e: Apple
Correct Guess

You have only 5 chance
Total correct word 3
Guess which phone brand name is this
 _p_o: Oppo
Correct Guess

You have only 5 chance
Total correct word 4
Guess which phone brand name is this
 M_c_om_x: Micromax
Correct Guess

You have only 5 chance
Total correct word 5
Guess which phone brand name is this
 _n_ex: Index
Wrong Guess

**********************************************
|        Congratulation! You won the Game    |
|        You have guessed 5 words correctly  |
**********************************************

दोस्तों जो आउटपुट आप इस प्रोजेक्ट का देख रहे है वह पूरा आउटपुट नहीं है यहाँ पर इस प्रोजेक्ट के आउटपुट को अच्छी तरह से दिखाना मुश्किल है इसलिए जब आप इस प्रोजेक्ट को खुद से रन करेंगे तो आप इसे अच्छी तरह समझ पाएंगे। फिर भी अगर आप इस प्रोजेक्ट को देखना चाहते है तो आप हमारी वीडियो देख सकते है जिसका लिंक हमने नीचे दिया है। 

4. word guessing game project video :-

दोस्तों अगर आप इस प्रोजेक्ट की वीडियो को देखना चाहते है तो इसका लिंक हमने नीचे दिया है। इस वीडियो में हमने इस गेम प्रोजेक्ट को अच्छी तरह समझाया है और साथ में इस गेम प्रोजेक्ट को रन करके भी दिखाया तो अगर आप इस वीडियो को देखना चाहते है तो नीच लिंक पर क्लिक करके देख सकते है। 


वीडियो देखने के लिए यहाँ क्लिक करें।


इन पोस्ट को भी पढ़े :-


Author :- तो दोस्तों अब हमारी यह word guessing game project कैसे बनाये in C language | with source code पोस्ट ख़त्म होती है हम आशा करते है की हमारी यह पोस्ट आपको जरूर पसंद आई होगी और आप इस word guessing game project को अच्छी तरह समझ गए होंगे। तो दोस्तों आज के लिए बस इतना ही फिर मिलेंगे ऐसी ही किसी और इंटरेस्टिंग पोस्ट में तब तक के लिए अलविदा !

Post a Comment

0 Comments