-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractica11a.c
More file actions
65 lines (59 loc) · 1.14 KB
/
practica11a.c
File metadata and controls
65 lines (59 loc) · 1.14 KB
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
56
57
58
59
60
61
62
63
64
65
#include <stdio.h>
#include <stdlib.h>
//CT
int main()
{
char txt[100], tex, letra;
int a = 0, e = 0, i = 0, o = 0, u = 0, z = 0, max;
FILE *y;
FILE *p;
y = fopen ("HolaMundo.txt", "r");
p = fopen ("HolaMundo.txt", "r");
printf("Hola Mundo\n");
while( (tex = fgetc(y)) != EOF ){
printf("%c", tex);
}
while ( (txt[z]=getc(p)) != EOF){
tex = txt[z];
switch (tex){
case 'a':
a++;
break;
case 'e':
e++;
break;
case 'i':
i++;
break;
case 'o':
o++;
break;
case 'u':
u++;
break;
}
z++;
}
printf("\nTotal de Vocales: %d\n", a + e + i + o + u);
max = a;
letra = 'a';
if(e > max){
max = e;
letra = 'e';
}
if(i > max){
max = i;
letra = 'i';
}
if(o > max){
max = o;
letra = 'o';
}
if(u > max){
max = u;
letra = 'u';
}
printf("La vocal que mas se repite es %c con %d repeticiones\n", letra, max);
fclose(p);
return 0;
}