1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
int nbr etat,nbr alph,tab *fin;
char *mot;
typedef struct etats {
int etat;
struct etats*next;
}ptr;
ptr*mat[nbr etat][nbr alph];
ptr*pt=NULL;
void chaine()
{
printf("entrez %s que vous voulez tester: ", mot);
scanf( "%s",mot);
}
/*creation d'une liste chainée==etats de lautomate qui sera dérerministe*/
ptr *creer()
{
int q;
ptr *pt;
do
{printf("entrer un %d: ",q);
scanf( "%d",&q);
if(pt==NULL) return NULL;
else
{
pt=(ptr*)malloc(sizeof(ptr));
pt->etat=q;
pt->next=creer();
}
return (pt);
}
while(q!=-1)}}
void automate()
{int i,j;
printf("entrer nbr etats: \n");
scanf( "%d",&nbr etats);
printf("entrer nbr alph: \n");
scanf( "%d",&nbr alph);
printf("entrer -1 si la transition n'execute pas\n ");
for(i=0;i<nbr etats;i++)
{ for(j=0;j<nbr alph;j++)
{printf("[%d][%c]= : \n",i,convertis(j));
creer()= mat[i][j];}}} |
Partager