Important: Use custom search function to get better results from our thousands of pages

Use " " for compulsory search eg:"electronics seminar" , use -" " for filter something eg: "electronics seminar" -"/tag/" (used for exclude results from tag pages)


Ask More Info Of  A Seminar Ask More Info Of A Project Post Reply  Follow us on Twitter
07-05-2011, 12:51 PM
Post: #1
Program in “C” to implement DFA.

Objective
Program in “C” to implement DFA.


Code:
#include<stdio.h>
#include<conio.h>
void main()
{
  int state[10];
  int str[10],input[10];
  char ch;
  int x[20];
  int s,n,k=0,j,a,i,l,t,q=0,fs,b,nxt;
  clrscr();
  printf("enter the no. states\n");
  scanf("%d",&s);
  printf("enter the no.of i/ps\n");
  scanf("%d",&n);
  for(i=0;i<s;i++)
  {
printf("enter the state\n");
scanf("%d",&state[i]);
printf("is it final state?... .y..1/n..0\n");
scanf("%d",&a);
if(a==1)
        fs=state[i];
  }
  printf("enter the i/ps\n");
  for(i=0;i<n;i++)
      scanf("%d",&input[i]);
  printf("transition state\n");
  
  for(i=0;i<s;i++)
  {
for(j=0;j<n;j++)
      {
printf("(q%d,%d)=q",state[i],input[j]);
scanf("%d",&b);
        x[k]=b; k++;
    }
  }
  printf("enter the length of string\n");
  scanf("%d",&l);
  printf("enter the i/p string\n");
  for(i=0;i<l;i++)
      scanf("%d",&str[i]);
  for(i=0;i<l;i++)
  {
      t=0;
     do
      {
          if(str[i]==input[t])
          {
              nxt=x[n*q+t];
for(j=0;j<s;j++)
{
              if(nxt==state[j])
                  q=j;
}
t++;
          }
          
           else
              t++;
     }
     while(t!=n);
  }
  if(nxt==fs)
      printf("\n string is accepted\n");
  else
      printf("\n not accepted\n");
  getch();
}
12-02-2016, 12:03 PM
Post: #2
RE: Program in “C” to implement DFA.
Plz give me a suitable output for this dfa program
15-03-2016, 11:12 PM
Post: #3
RE: Program in “C” to implement DFA.
i need a c program to implement a dfa simulator ....such that the program should run for all the dfa's given as input
05-04-2016, 04:47 PM
Post: #4
RE: Program in “C” to implement DFA.
Program in “C” to implement DFA

#include<stdio.h>
#include<conio.h>
void main()
{
int state[10];
int str[10],input[10];
char ch;
int x[20];
int s,n,k=0,j,a,i,l,t,q=0,fs,b,nxt;
clrscr();
printf("enter the no. states\n");
scanf("%d",&s);
printf("enter the no.of i/ps\n");
scanf("%d",&n);
for(i=0;i<s;i++)
{
printf("enter the state\n");
scanf("%d",&state[i]);
printf("is it final state?... .y..1/n..0\n");
scanf("%d",&a);
if(a==1)
fs=state[i];
}
printf("enter the i/ps\n");
for(i=0;i<n;i++)
scanf("%d",&input[i]);
printf("transition state\n");

for(i=0;i<s;i++)
{
for(j=0;j<n;j++)
{
printf("(q%d,%d)=q",state[i],input[j]);
scanf("%d",&b);
x[k]=b; k++;
}
}
printf("enter the length of string\n");
scanf("%d",&l);
printf("enter the i/p string\n");
for(i=0;i<l;i++)
scanf("%d",&str[i]);
for(i=0;i<l;i++)
{
t=0;
do
{
if(str[i]==input[t])
{
nxt=x[n*q+t];
for(j=0;j<s;j++)
{
if(nxt==state[j])
q=j;
}
t++;
}

else
t++;
}
while(t!=n);
}
if(nxt==fs)
printf("\n string is accepted\n");
else
printf("\n not accepted\n");
getch();
}
Rating Program in “C” to implement DFA. Options
Share Program in “C” to implement DFA. To Your Friends :- Seminar Topics Bookmark
Post Reply 

Marked Categories : c code for implementation of dfa, implementing dfa in c, dfa program in c, dfa programming in c, program in c of dfa, c programing implimwnting dfa, implementation of dfa accept any string in c, c program implimenting dfa, implement dfa using c proram, program in c for dfa, dfa programming inc, c program for dfa, implementing dfa through c, program in c to implement dfa, program to implement dfa in c, dfa implimentation in c, c program for a dfa, c program to implement dfa, dfa c program, how to implement a dfa in c, c program for implementing a dfa, dfa c code, dfa program in c language, implementation of c program for dfa, dfa implementation in c, c program of dfa,

[-]
Quick Reply
Message
Type your reply to this message here.


Image Verification
Image Verification
(case insensitive)
Please enter the text within the image on the left in to the text box below. This process is used to prevent automated posts.

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  PROGRAM TO DISPLAY A MOVING BANNER USING APPLET project topics 2 107,816 25-04-2016 02:28 PM
Last Post: dhanabhagya
  PROGRAM TO DRAW A HUMAN FACE USING APPLET project topics 3 147,616 22-02-2015 11:12 AM
Last Post: Guest
  Program to Encrypt and decrypt a text data using RSA algorithm smart paper boy 7 17,763 05-02-2015 10:08 AM
Last Post: Guest
  To write a program in C# to perform conversion of dollars to rupees smart paper boy 1 9,155 02-05-2013 10:40 AM
Last Post: Guest
  PROGRAM TO DISPLAY MARK LIST OF N STUDENTS project topics 1 45,035 11-03-2013 02:20 PM
Last Post: Guest
  VHDL program for Booth’s Multiplier smart paper boy 2 7,283 09-04-2012 10:34 AM
Last Post: seminar paper
  Implement DES Algorithm smart paper boy 1 3,651 16-02-2012 12:34 PM
Last Post: seminar paper
  PROGRAM TO RECOGNIZE A STRING WITH THREE COSECUTIVE 0’s smart paper boy 0 1,173 10-08-2011 11:44 AM
Last Post: smart paper boy
  : PROGRAM TO IDENTIFY VOWELS AND CONSONANTS GIVEN AS INPUT smart paper boy 0 2,362 10-08-2011 11:44 AM
Last Post: smart paper boy
  : Implement Diijkstra’s algorithm to compute the shortest path through a graph smart paper boy 0 1,275 10-08-2011 11:42 AM
Last Post: smart paper boy
This Page May Contain What is Program in “C” to implement DFA. And Latest Information/News About Program in “C” to implement DFA. ,If Not ...Use Search to get more info about Program in “C” to implement DFA. Or Ask Here

Options: