Enviado em 14/12/2017 - 08:45h
Olá,L={yxz|y E {a,b,c}+ e z E {1,2,3}+}
abcx123
23ax2b1
bx31
a2x3b
bcax321
#include <stdio.h>
#include <stdlib.h>
FILE *arquivo;
void voltaLeitura()
{
fseek(arquivo, -1, SEEK_CUR);
}
char getSimbolo()
{
char temp;
if(arquivo==NULL)
{
printf("Erro: arquivo n�o aberto!\n");
return EOF;
}
temp = fgetc(arquivo);
return temp;
}
int AFD()
{
int E=0;
char S='i';
while(S!=EOF)
{
S=getSimbolo();
switch(E)
{
case 0:
if(S=='a'||S=='b'||S=='c')
E=1;
else
E=0;
break;
case 1:
if(S=='x')
E=2;
else if(S=='a'||S=='b'||S=='c')
E=1;
else
E=0;
break;
case 2:
if(S=='1'||S=='2'||S=='3')
E=3;
else if(S=='a'||S=='b'||S=='c')
E=1;
else
E=0;
break;
case 3:
if(S=='1'||S=='2'||S=='3')
E=3;
else
E=4;
break;
}
}
if(E==4) return 1;
return -1;
}
int main()
{
int retorno;
arquivo = fopen("entrada2b.txt", "r");
retorno = AFD();
if(retorno == 1)
printf("Valido\n");
else if(retorno == -1)
printf("Invalido\n");
fclose(arquivo);
return 0;
}
Como gerar um podcast a partir de um livro em PDF
Automatizando digitação de códigos 2FA no browser
Resolver problemas de Internet
Como compartilhar a tela do Ubuntu com uma Smart TV (LG, Samsung, etc.)
Como Instalar o Microsoft Teams no Linux Ubuntu
Músicas de Andrew Hulshult no DOOM (WAD)
Instalar o Apache, MySQL e PHP no Oracle Linux 8
Bloqueando telemetria no Deepin 23.1
Como converter imagens PNG/JPEG para SVG em linha de comando