Se me queda en el loop
Publicado por Armando (4 intervenciones) el 05/01/2021 22:55:19
hola, buenas tardes soy algo nuevo con esto de la programacion, y he estado haciendo las 2 ultimas semanas, un proyecto para un trabajo escolar y ya no se que hacer, si alguien me puede ayudar me puede contactar.
No se que tiene pero solo se que se queda en loop.
No se que tiene pero solo se que se queda en loop.
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
#include <iostream>
#include <conio.h>
#include <string.h>
#include <stdio.h>
#include <fstream>
#include <string>
#include <stdlib.h>
using namespace std;
struct uxar {
int name;
int user;
int canal;
};
struct uxar uxa [100];
struct clasifchan{
int mature;
int all;
int kids;
};
struct clasifchan ccan [100];
struct clasifvgam{
char shooter;
int aventura;
int deporte;
int terror;
int estrategia;
};
struct clasifvgam cvgam[100];
void registrar();
void reader ();
void editar();
void borrar();
int opc,s,p,k,phile,kalum,repeat,opc2,opc3,erasechan,opc4,opc5,opc6,opc7;
int main(){
cout<<"Bienvenido a twitch"<<endl;
cout<<"--------------------------"<<endl;
cout<<"¿que desea hacer?"<<endl;
cout<<"1-registrar usuario"<<endl;
cout <<"2-borrar usuario"<<endl;
cout<<"3-Editar usuario"<<endl;
cout<<"4-ver lista de usuarios"<<endl;
cout<<"5-salir del programa"<<endl;
cin>>opc;
switch (opc){
case 1: cout<<"Registrar usuario"<<endl;
registrar();
break;
case 2: cout<<"Borrar usuario"<<endl;
borrar();
break;
case 3: cout<<"Editar usuario"<<endl;
editar();
break;
case 4: cout<<"ver lista"<<endl;
reader();
break;
case 5: cout<<"salir"<<endl;
if (opc = 5) {
cout << "seguro que quieres?" << endl;
cout << "\n 1-si" << endl;
cout << "\n 2-no" << endl;
cin >> s;
if (s = 1) {
return 0;
}
else {
return main();
}
break;
default: cout << "no valido, intenta de nuevo" << endl;
return main();
}
}
return 0;
}
void registrar(){
string name;
phile=p;
kalum=k;
repeat=1;
while(repeat==1){
system("cls");
cout<<"Registro de usuarios"<<endl;
for(p=1;p<=phile;p++){
ofstream erchive;
erchive.open("Usuarios.txt",ios::app);
cout<<"ingerese nombre"<<endl;
getline(cin,name);
cin>>uxa[0].name;
cout<<"ingrese nickname"<<endl;
cin>>uxa[0].user;
cout<<"ingrese nombre canal"<<endl;
cin>>uxa[0].canal;
cout<<"ingrese clasif. de canal"<<endl;
cout<<"¿Que clasificacion es su canal?"<<endl;
cout<<"1-mature (solo para mayores de 18"<<endl;
cout<<"2-all(para todos)"<<endl;
cout<<"3-kids (solo publico infantil)"<<endl;
cin>>opc2;
switch(opc2){
case 1:
cin>>ccan[0].mature;
break;
case 2:
cin>>ccan[0].all;
break;
case 3:
cin>>ccan[0].kids;
break;
}
cout<<"ingrese clasif del videojuego"<<endl;
cout<<"¿Que clasificacion es su videojuego?"<<endl;
cout<<"1-Aventura"<<endl;
cout<<"2-Deporte"<<endl;
cout<<"3-Estrategia"<<endl;
cout<<"4-Shooter"<<endl;
cout<<"5-Terror"<<endl;
cin>>opc3;
switch (opc3){
case 1:
cin>>cvgam[0].aventura;
break;
case 2:
cin>>cvgam[0].deporte;
break;
case 3:
cin>>cvgam[0].estrategia;
break;
case 4:
cin>>cvgam[0].shooter;
break;
case 5:
cin>>cvgam[0].terror;
break;
}
}
cout<<"¿registrar otro?"<<endl;
cin>>repeat;
}
}
void borrar(){
phile=p;
kalum=k;
repeat=1;
while (repeat==1){
system("pause");
system ("cls");
cout<<"Bienvenido a la eliminacion de canales"<<endl;
cout<<"ingrese los datos del canal a borrar"<<endl;
cin>>erasechan;
string erasechan;
for(p=0;p<=phile;p++){
ofstream archivo;
archivo.open("usuarios.txt",ios::app);
cin>>uxa[0].name;
cin>>uxa[0].user;
cin>>uxa[0].canal;
cout<<"1-maduro"<<endl;
cout<<"2-all"<<endl;
cout<<"3-kids"<<endl;
cin>>opc4;
switch(opc4){
case 1:
cin>>ccan[0].mature;
break;
case 2:
cin>>ccan[0].all;
break;
case 3:
cin>>ccan[0].kids;
break;
}
cout<<"1-aventura"<<endl;
cout<<"2-deporte"<<endl;
cout<<"3-estrategia"<<endl;
cout<<"4-shooter"<<endl;
cout<<"5-terror"<<endl;
cin>>opc5;
switch(opc5){
case 1:
cin>>cvgam[0].aventura;
break;
case 2:
cin>>cvgam[0].deporte;
break;
case 3:
cin>>cvgam[0].estrategia;
break;
case 4:
cin>>cvgam[0].shooter;
break;
case 5:
cin>>cvgam[0].terror;
break;
}
}
}
}
void reader(){
ifstream archive,text;
archive.open("usuarios.txt",ios::in);
while(!archive.eof()){
phile=p;
kalum=k;
for(p=0;p<=phile;p++){
cout<<"ingrese nombre"<<endl;
cin>>uxa[0].name;
cout<<"ingrese nickname"<<endl;
cin>>uxa[0].user;
cout<<"ingrese canal"<<endl;
cin>>uxa[0].canal;
cout<<"ingrese clasif canal"<<endl;
cout<<"1-maduro"<<endl;
cout<<"2-all"<<endl;
cout<<"3-kids"<<endl;
cin>>opc4;
switch(opc4){
case 1:
cin>>ccan[0].mature;
break;
case 2:
cin>>ccan[0].all;
break;
case 3:
cin>>ccan[0].kids;
break;
}
cout<<"ingrese clasif vgam"<<endl;
cout<<"1-aventura"<<endl;
cout<<"2-deporte"<<endl;
cout<<"3-estrategia"<<endl;
cout<<"4-shooter"<<endl;
cout<<"5-terror"<<endl;
cin>>opc5;
switch(opc5){
case 1:
cin>>cvgam[0].aventura;
break;
case 2:
cin>>cvgam[0].deporte;
break;
case 3:
cin>>cvgam[0].estrategia;
break;
case 4:
cin>>cvgam[0].shooter;
break;
case 5:
cin>>cvgam[0].terror;
break;
}
cout<<"la persona"<<uxa[0].name<<endl;
cout<<"de nickname"<<uxa[0].user<<endl;
cout<<"y su canal"<<uxa[0].canal<<endl;
}
}
}
void editar()
{
string name;
phile=p;
kalum=k;
repeat=1;
while(repeat==1){
cout<<"Bienvenido a editor"<<endl;
for(p=0;p<=phile;p++){
ofstream fisat;
fisat.open("usuarios.txt",ios::app);
cout<<"ingrese nombre"<<endl;
getline (cin,name);
cin>>uxa[0].name;
cout<<"ingrese nickname"<<endl;
cin>>uxa[0].user;
cout<<"ingrese nombre canal"<<endl;
cin>>uxa[0].canal;
cout<<"ingrese clasif.canal"<<endl;
cout<<"1-Mature"<<endl;
cout<<"2-All"<<endl;
cout<<"3-Kids"<<endl;
cin>>opc2;
switch(opc2){
case 1:
cin>>ccan[0].mature;
break;
case 2:
cin>>ccan[0].all;
break;
case 3:
cin>>ccan[0].kids;
break;
}
cout<<"ingrese clasif.vgam"<<endl;
cout<<"1-Aventura"<<endl;
cout<<"2-Deporte"<<endl;
cout<<"3-Estrategia"<<endl;
cout<<"4-Shooter"<<endl;
cout<<"5-Terror"<<endl;
cin>>opc3;
switch(opc3){
case 1:
cin>>cvgam[0].aventura;
break;
case 2:
cin>>cvgam[0].deporte;
break;
case 3:
cin>>cvgam[0].estrategia;
break;
case 4:
cin>>cvgam[0].shooter;
break;
case 5:
cin>>cvgam[0].terror;
break;
}
cout<<"¿desea editar otro?"<<endl;
cin>>repeat;
}
}
}
Valora esta pregunta


0