SHOW:
|
|
- or go back to the newest paste.
1 | #include <stdio.h> | |
2 | #include <stdlib.h> | |
3 | ||
4 | /* run this program using the console pauser or add your own getch, system("pause") or input loop */ | |
5 | ||
6 | int main(int argc, char *argv[]) | |
7 | { | |
8 | int pre[10]; | |
9 | int i, aux1, aux2; | |
10 | ||
11 | printf("Digite alguns numeros por favor:\n\n"); | |
12 | ||
13 | scanf("%d", &pre[i]); | |
14 | ||
15 | for (i=0; i<10; i++) | |
16 | { | |
17 | - | if(pre[i]!='\0') |
17 | + | if(pre[i]='\0') |
18 | { | |
19 | aux1=(i-1); | |
20 | aux2=(i-2); | |
21 | i=10; | |
22 | } | |
23 | } | |
24 | ||
25 | for (i=0; i<10; i++) | |
26 | { | |
27 | if ((pre[i]!=0)&&(pre[i]!=1)) | |
28 | { | |
29 | printf("Cadeia de caracteres digitados invalida!\n\n"); | |
30 | i=10; | |
31 | } | |
32 | ||
33 | else | |
34 | { | |
35 | if((pre[aux1]!=1)&&(pre[aux2]!=0)) | |
36 | { | |
37 | printf("Sufixo da cadeia não aceito!"); | |
38 | } | |
39 | ||
40 | else | |
41 | { | |
42 | printf("Cadeia aceita com sucesso!"); | |
43 | i=10; | |
44 | } | |
45 | } | |
46 | } | |
47 | return 0; | |
48 | } |