AYUDA POR FAVOR!! Tengo un problema con este programa.
Publicado por rafavel (2 intervenciones) el 05/09/2020 08:00:38
Este tiene que ser su funcionamiento
--------------------------------------------------------------------------------------------
MENU PRINCIPAL
A) OPERACIONES NUMERICAS
B) OPRACIONES ALFANUMERICAS
C) SALIR
MENU OPERACIONES NUMERICAS
a) RESOLUCION DE LA ECUACION GENERAL DE SEGUNDO GRADO
b) OBTENER LOR PRIMEROS 100 NUMEROS PRIMOS
c) OBTENER EL FACTORIAL DE UN NUMERO (NUMERO MAXIMO 50)
d) REGRESAR MENU ANTERIOR
MENU OPERACIONES ALFANUMERICAS
X ) LEER UN TEXTO MAXIMO 500 CARACTERES Y MOSTRAR TEXTO INTRODUCIDO Y
TEXTO AL REVES.
Y) LEER UN TEXTO MAXIMO 500 CARACTERES Y CONTAR Y MOSTRAR CUANTAS LETRAS
VOCALES HAY ESCRITAS (CUANTAS A, CUANTAS E, CUANTAS I, CUANTAS O, CUANTAS U).
Y CUANTOS SIGNOS DE PUNTUACION HAY.
Z) REGRESAR MENU ANTERIOR.
---------------------------------------------------------------------------------------------
tengo problemas al momento de dar las respuestas de todos los incisos solo se muestran 1ms y se van
tambien mi progama no regresa al menu anterior dentro de los incisos A y B
y en el caso del inciso Y tengo 2 problemas mas, me marca el error: [Error] a label can only be part of a statement and a declaration is not a statement y el segundo problema es que no tengo ni idea de como contar los signos de puntuacion
--------------------------------------------------------------------------------------------
MENU PRINCIPAL
A) OPERACIONES NUMERICAS
B) OPRACIONES ALFANUMERICAS
C) SALIR
MENU OPERACIONES NUMERICAS
a) RESOLUCION DE LA ECUACION GENERAL DE SEGUNDO GRADO
b) OBTENER LOR PRIMEROS 100 NUMEROS PRIMOS
c) OBTENER EL FACTORIAL DE UN NUMERO (NUMERO MAXIMO 50)
d) REGRESAR MENU ANTERIOR
MENU OPERACIONES ALFANUMERICAS
X ) LEER UN TEXTO MAXIMO 500 CARACTERES Y MOSTRAR TEXTO INTRODUCIDO Y
TEXTO AL REVES.
Y) LEER UN TEXTO MAXIMO 500 CARACTERES Y CONTAR Y MOSTRAR CUANTAS LETRAS
VOCALES HAY ESCRITAS (CUANTAS A, CUANTAS E, CUANTAS I, CUANTAS O, CUANTAS U).
Y CUANTOS SIGNOS DE PUNTUACION HAY.
Z) REGRESAR MENU ANTERIOR.
---------------------------------------------------------------------------------------------
tengo problemas al momento de dar las respuestas de todos los incisos solo se muestran 1ms y se van
tambien mi progama no regresa al menu anterior dentro de los incisos A y B
y en el caso del inciso Y tengo 2 problemas mas, me marca el error: [Error] a label can only be part of a statement and a declaration is not a statement y el segundo problema es que no tengo ni idea de como contar los signos de puntuacion
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
//* *//
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <math.h>
#define numVocales 5
#define tamFrase 500
int a,b,c,d;
int i,x,cont;
int x,numero;
int i = 0;
int j;
float xg,yg;
float factorial=1;
char m1, m2,sm1,sm2;
char cadena[200];
x=100;
cont=0;
main()
{
system("color f0");
do{
system("cls");
printf(" M E N U P R I N C I P A L ");
printf("\n A).-Operaciones Numericas");
printf("\n B).-Operaciones Alfa-Numericas");
printf("\n C).-Salir");
printf("\n\n Elija la opcion: ");
scanf("%c",&m1);
switch(m1)
{
case 'A':
do{
system("cls");
printf("\n OPERACIONES NUMERICAS");
printf("\n a).-Resolucion de la ecuacion general de segundo grado \n");
printf("\n b).-Obtener los primeros 100 numeros primos \n");
printf("\n c).-Obtener el factorial de un numero (maximo:50) \n");
printf("\n d).-Regresar al menu anterior \n");
printf("\n\n Elija una opcion: ");
scanf("%c",&sm1);
switch(sm1)
{
case 'a':
printf("Dame el valor de a: ");
scanf("%d",&a);
while (a == 0)
{
printf("Dame el valor de a: ");
scanf("%d",&a);}
printf("Dame el valor de b: ");
scanf("%d",&b);
printf("Dame elvalor de c: ");
scanf("%d",&c);
d = b*b-4*a*c;
if (d > 0)
{
xg = (-b+sqrt(d))/(2*a);
yg = (-b-sqrt(d))/(2*a);
printf("x1 = %.2f\n",xg);
printf("x2 = %.2f\n",yg);}
else if (d == 0) {
xg = (-b)/(2*a);
printf("x1 = %.2f\n",xg);}
else
printf("La ecuacion no tiene solucion");
break;
case 'b':
for(i = 2 ; i <=542;i++)
{
for(x = 2 ; x <= i;x++)
if(i % x == 0)
cont++;
if(cont == 1)
printf("%d-",i);
cont = 0 ;}
break;
case 'c':
printf("Introduce un numero:");
scanf("%d",&numero);
for(x=numero;x>1;x--)
{
factorial=factorial*x;
}
printf("%f",factorial);
break;
case 'd':break;
}
}while(sm1!="d");
case 'B':
system("cls");
printf("\n OPERACIONES ALFA-NUMERICAS");
printf("\n X).-Leer un texto (maximo 500 caracteres) y mostrar el texto introducido al reves \n");
printf("\n Y).-Leer un texto (maximo 500 caracteres) y contar cuantas letras vocales hay escritas \n");
printf("\n Z).-Regresar al menu anterior \n");
printf("\n\n Elija una opcion: ");
scanf("%c",&m2);
case 'X':
printf("Introduce tu texto: ");
gets(cadena);
printf("\nTu texto es: %s\n", cadena);
while(cadena[i]!='\0'){
i++;}
printf("El texto al rev\x82s es: ");
for (j=i-1; j>=0; j--){
printf("%c", cadena[j]);}
puts("");
break;
case 'Y':
void cuentaVocales( char frase[] , char vocales[] )
{
for( int i=0; i< numVocales; i++)
vocales[i] = 0;
for( int i=0; i < tamFrase; i++)
{
switch(frase[i])
{
case 'a': vocales[0]++; break;
case 'e': vocales[1]++; break;
case 'i': vocales[2]++; break;
case 'o': vocales[3]++; break;
case 'u': vocales[4]++; break;
}
}
}
void muestraVocales(char vocales[])
{
printf(" a: %d\n", vocales[0] );
printf(" e: %d\n", vocales[1] );
printf(" i: %d\n", vocales[2] );
printf(" o: %d\n", vocales[3] );
printf(" u: %d\n", vocales[4] );
}
int main()
{
float frase[tamFrase],
vocales[numVocales];
printf("Escribe tu texto :" );
gets(frase);
cuentaVocales(frase, vocales);
muestraVocales(vocales);
break;
case 'Z':break;
break;
case 'C':break;
}
}while(m1!="C");
system("pause");
return (0);
}
Valora esta pregunta


0