
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;
}
Cirurgia para acelerar o openSUSE em HD externo via USB
Void Server como Domain Control
Modo Simples de Baixar e Usar o bash-completion
Monitorando o Preço do Bitcoin ou sua Cripto Favorita em Tempo Real com um Widget Flutuante
Atualizar Linux Mint 22.2 para 22.3 beta
Jogar games da Battle.net no Linux com Faugus Launcher
Como fazer a Instalação de aplicativos para acesso remoto ao Linux
Assisti Avatar 3: Fogo e Cinzas (2)
Conky, alerta de temperatura alta (8)
Duas Pasta Pessoal Aparecendo no Ubuntu 24.04.3 LTS (42)









