Dev - C++ - Ayuda, no entiendo por que no se me copila el programa

 
Vista:
Imágen de perfil de Rolando
Val: 16
Ha disminuido 1 puesto en Dev - C++ (en relación al último mes)
Gráfica de Dev - C++

Ayuda, no entiendo por que no se me copila el programa

Publicado por Rolando (5 intervenciones) el 18/12/2019 21:24:08
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
 
int main()
{
	int opcion;
 
	system("title MENU DE OPCIONES");
	do {
		system("cls");
		system("color 1e");
 
 
		cout << "\n\n\t\t\t\tMENU DE OPCIONES" << endl;
		cout << "\t\t\t\t----------------" << endl << endl;
		cout << "\t1. Programa Vector" << endl;
		cout << "\t2. Programa Matriz" << endl;
		cout << "\t3. Programa Ordenamiento" << endl;
		cout << "\t4. SALIR DEL MENU" << endl;
 
		cout << "\n\tIngrese una opcion ===> ";
		cin >> opcion;
 
		system("cls");
		cout << "\a";
		switch (opcion) {
			case 1:
				 {
 
const int sz = 10;
 
    int v[sz];
    int suma = 0;
 
    cout << "\nIntroducir datos:\n";
    for( int i = 0; i < sz; i++ ) {
        cout << "(" << i + 1 << "/" << sz << "): ";
        cin >> v[i];
        suma += v[i];
    }
 
    cout << "\nEl vector es: ";
    for( int i = 0; i < sz; i++ )
        cout << v[i] << " ";
 
    cout << "\nSuma: " << suma << endl;
 
 }
 system("pause>nul"); // Pausa
				break;
			case 2:
				 {
 
const int sx = 2;
 
void leerMatriz( int v[sx][sx] );
void imprimirMatriz( int v[sx][sx] );
 
{
    int A[sx][sx];
    int B[sx][sx];
    int R[sx][sx];
 
    cout << "\nDatos Matriz A:\n";
    leerMatriz( A );
 
    cout << "\nDatos Matriz B:\n";
    leerMatriz( B );
 
    for( int i = 0; i < sx; i++ ) {
        for( int j = 0; j < sx; j++ ) {
            R[i][j] = A[i][j] + B[i][j];
        }
    }
 
    cout << "\n Matriz A:\n";
    imprimirMatriz( A );
 
    cout << "\n Matriz B:\n";
    imprimirMatriz( B );
 
    cout << "\n Matriz A + B:\n";
    imprimirMatriz( R );
 
    system("pause>nul"); // Pausa
 
 
}
 
void leerMatriz( int v[sx][sx] )
 
 
 
{
    for( int i = 0; i < sx; i++ ) {
        for( int j = 0; j < sx; j++ ) {
            cout << "[" << i << "][" << j << "]: ";
            cin >> v[i][j];
        }
    }
}
 
void imprimirMatriz( int v[sx][sx] )
{
    for( int i = 0; i < sx; i++ ) {
        cout << " | ";
        for( int j = 0; j < sx; j++ ) {
            cout << v[i][j] << " ";
        }
        cout << " |\n";
    }
}
 
				}
				system("pause>nul"); // Pausa
				break;
 
			case 3:
				{
 
			const int sy = 10;
 
void leerDatos( int v[] );
void ordenarDatos( int v[] );
void imprimirDatos( const int v[] );
int buscar( const int v[], int valor );
 
{
    int numeros[sy];
    int buscado, pos;
 
    cout << "\nIntroducir datos:\n";
    leerDatos( numeros );
    ordenarDatos( numeros );
    cout << "\nDatos ordenados: ";
    imprimirDatos( numeros );
 
    cout << "\nNumero a buscar: ";
    cin >> buscado;
 
    pos = buscar( numeros, buscado );
 
    (pos == -1 ? cout << "No encontrado" : cout << "Encontrado en la posicion " << pos);
    cout << endl;
 
    return 0;
}
 
void leerDatos( int v[] )
{
    for( int i = 0; i < sy; i++ ) {
        cout << "(" << i + 1 << "/" << sy << "): ";
        cin >> v[i];
    }
}
 
void ordenarDatos( int v[] )
{
    int valor;
    int j;
 
    for(int i = 1; i < sy; i++) {
        valor = v[i];
        j = i;
        while( j > 0 && valor < v[j-1] ) {
            v[j] = v[j-1];
            j--;
        }
        v[j] = valor;
    }
}
 
void imprimirDatos( const int v[] )
{
    for( int i = 0; i < sy; i++ )
        cout << v [i] << " ";
 
    cout << endl;
}
 
int buscar( const int v[], int buscado )
{
    int pos = 0;
 
    while( pos < sy && v[pos] != buscado ) {
        pos++;
    }
    if (pos >= sy) {
        pos = -1;
    }
    return pos;
}
 
				}
				system("pause>nul"); // Pausa
				break;
 
 
		}
	} while (opcion != 4);
	return 0;
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Alfil
Val: 4.344
Oro
Ha mantenido su posición en Dev - C++ (en relación al último mes)
Gráfica de Dev - C++

Ayuda, no entiendo por que no se me copila el programa

Publicado por Alfil (1444 intervenciones) el 18/12/2019 23:35:06
Te faltan las declaraciones de las funciones, debajo de using namespace std
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar
Imágen de perfil de Rolando
Val: 16
Ha disminuido 1 puesto en Dev - C++ (en relación al último mes)
Gráfica de Dev - C++

Ayuda, no entiendo por que no se me copila el programa

Publicado por Rolando (5 intervenciones) el 19/12/2019 03:09:06
Como cuales declaraciones? los void?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar