Make Guess the number game using C language in hindi
Guess The Number गेम कैसे बनाए C language से?
आज के इस आर्टिकल मैं हम आपको बताएंगे Guess The Number C language से कैसे बनाएं ?
विजुअल स्टूडियो कोड इंस्टॉल कीजिए।
IDE(Integrated development environment)
यह एक टूल है जिसका उपयोग हम अपने कोड को अच्छी तरह लिखने के लिए कर सकते हैं ।
यहां से आप विजुअल स्टूडियो कोड IDE को कंप्यूटर में डाउनलोड कर सकते है। नीचे दी हुई लिंक पे जाइए ।
Visual Studio Code  इंस्टाल करने के बाद कुछ ऐसा दिखेगा।
Source: vs code
नई C File बनाए Vs Code में।
यदि आप कोई कोडिंग नहीं जानते हैं तो बस नीचे दिए गए कोड को कॉपी करें और इसे चलाने के लिए बनाम कोड में पेस्ट करें। यदि आप कोड करना जानते हैं तो जारी रखें।
कोड यहां से शुरू है ।
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
    int number, guess, repeat = 0, hard = 1, attempts = 1;
    srand(time(0));
    number = rand() % 100 + 1;
    do
    { 
        printf("Guess The Number Between 1 to 100\n");
        scanf("%d", &guess);
        if (guess < number)
        {
            printf("Higher Number Please !\n");
        }
        else if (guess > number)
        {
            printf("Lower Number Please !\n");
        }
        else
        {
            printf("You guessed it in %d attempts\n", attempts);
            printf("Enter 1 to play again\n");
            scanf("%d", &repeat);
            if (repeat = 1)
            {
                srand(time(0));
                number = rand() % 100 + 1;
                continue;
            }
        }
        attempts++;
    } while (hard == 1);
    return 0;
}
Code यहां समाप्त हैं।
इस आर्टिकल को पढ़ने के लिए धन्यवाद :)


 
 
टिप्पणियाँ
एक टिप्पणी भेजें