Menus

Nov 14, 2014

A Game made by using C language to find the name that you have thought.

A Game made by using C language to find the name that you have thought.

(This software is made by a BCA's Student :Paawan Prashad Bhatt)


#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<graphics.h>
void main()
{
    int n,i,j,column[50],k;
    char alphabet1[][5]={"ABCDE","FGHIJ","KLMNO","PQRST","UVWXY","Z"},alphabet2[50][6],alphabet3[50][50],next='y';
    int gd=DETECT,gm;
    initgraph(&gd,&gm,"c:\\turboc3\\bgi");
    setbkcolor(BLUE);
    printf("\n\t\t*************************************************");
    printf("\n\t\t*************************************************");
    printf("\n\t\t  *********MIRACLE  KI DUNIYA ME WELCOME*********");
    printf("\n\t\t*************************************************");
    printf("\n\t\t*************************************************");
    printf("\n\t\t*************************************************");
    printf("\n\t\t*************************************************");
    aa:
    printf("\n\n\nPlease think of a word. You can think noun, pronoun, verb, adjective or anything that you want.");
    printf("\n\nNow please tell me, how many letters word you have thought \?\n");
    scanf("%d",&n);
    printf("\n\n");
    //Displaying A to Z.
    printf("0\t1\t2\t3\t4\n");
    for(i=0;i<6;i++)
    {
        for(j=0;j<5;j++)
        printf("%c\t",alphabet1[i][j]);
        printf("\n");
    }
    //Asking Questions about column(1)
    for(i=0;i<n;i++)
    {
        printf("\n\nIn which column the %d letter of the word you have thought is \?\n",i+1);
        scanf("%d",&column[i]);
    }
    printf("\n\n");
    //Displaying and storing first artificial alphabet matrix.
    printf("0\t1\t2\t3\t4\t5\n");
    for(i=0;i<n;i++)
    {
        for(j=0;j<5;j++)
        {
            if(j==column[i])
            for(k=0;k<6;k++)
            {
                printf("%c\t",alphabet1[k][j]);
                alphabet2[i][k]=alphabet1[k][j];
            }
        }
        printf("\n");
    }
    //Asking questions about column(2)
    for(i=0;i<n;i++)
    {
        printf("\n\nIn which column the %d letter of the word you have thought is \?\n",i+1);
        scanf("%d",&column[i]);
    }
    //Storing second artificial alphabet matrix.
    for(i=0;i<n;i++)
    {
        for(j=0;j<6;j++)
        {
            if(j==column[i])
            for(k=0;k<n;k++)
            alphabet3[i][k]=alphabet2[k][j];
        }
    }
    printf("\n\nSuper program is sending singal to your mind...\n\n");
    printf("Super program is reading your mind...\n\n");
    printf("Super program is fetching data from your mind...\n\n");
    //Displaying the answer.
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
        {
            if(i==j)
            printf("%c",alphabet3[i][j]);
        }
    }
    printf("\n\nDo you want to play again\?(y/n)");
    next=getche();
    if(next=='y'||next=='Y')
    {
        goto aa;
    }
    else
    exit(0);
    getch();
}

No comments:

Post a Comment

Contact Form

Name

Email *

Message *