¿Por que mi do-while no se repite ?
Publicado por ian (4 intervenciones) el 20/12/2020 02:21:00
estoy haciendo este código para un proyecto alguien me puede decir por que el do-while no se repite aun no termino el código sigo trabajando en el gracias por cualquier ayuda
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
#include <stdlib.h>
#include <windows.h>
#include <iostream>
#include <math.h>
using namespace std;
//PROTOTIPOS DE LAS FUNCIONES
void dibujarCuadro(int x1,int y1,int x2,int y2);
void gotoxy(int x,int y);
//FUNCION PRINCIPAL MAIN
int main(){
system("mode con: cols=80 lines=25"); //SE DEFINE LAS DIMENSIONES DE LA VENTANA DEL PROGRAMA A 80 COLUMNAS Y 25 FILAS
system("COLOR 8f"); //SE DA UN COLOR DE FONDO Y COLOR A LAS LETRAS
dibujarCuadro(0,0,78,24); //SE DIBUJA EL CUADRO PRINCIPAL
dibujarCuadro(1,1,77,3); //SE DIBUJA EL CUADRO DEL TITULO
gotoxy(30,2); cout << "NAVAGAME";
printf ("\n\n\t bienvenido \n");
char NOM[20],DIS ;
int OP ,SE, O ,COM;
float AR1,AR2,AR3,AR4,AR5,AR6,AR7,TO,CAN1,CAN2,CAN3,CAN4,CAN5,CAN6,CAN7;
do
{
printf ("\t ¿desea comprar algo en en la tienda? \t 1=si 2=no \t");
fflush( stdin );
scanf( "%d", &SE);
if (SE == 1 )
{
printf("\t seleciona que distribuidor de video juegos decea comprar \n ");
printf ("\t 1.-SONY\n");
printf ("\t 2.-MICROSOFT\n");
printf("\t 3.-NITENDO \n\n");
printf ("\t 4.- computo \n");
scanf("%d",&OP);
switch (OP){ do{
case 1: system("color 1f");
system("cls");
system("mode con: cols=82 lines=36"); //SE DEFINE LAS DIMENSIONES DE LA VENTANA DEL PROGRAMA A 80 COLUMNAS Y 25 FILAS
dibujarCuadro(0,0,80,35); //SE DIBUJA EL CUADRO PRINCIPAL
dibujarCuadro(1,1,77,3); //SE DIBUJA EL CUADRO DEL TITULO
gotoxy(30,2); cout << "NAVAGAME \n";
printf ("\t\n 1-.consola o acesorios \t");
printf ("\t\n 2.-video juegos \t");
scanf ("%d",&O);
switch (O)
case 1: printf ("\n \t 1.-playstation 5 $13500 \t");
scanf("\t %f",&CAN1);
printf ("\n\t 2.-playstation 4 $12000 \t");
scanf("\t %f",&CAN2);
printf("\n\t 3.-dualshock ps4 $1200 \t");
scanf("\t %f",&CAN3);
printf("\n\t 4.-dualsense ps5 $1350 \t");
scanf("\t %f",&CAN4);
printf ("\n\t 5.-Headset $1000 \t");
scanf("\t %f",&CAN5);
printf ("\n\t 6.-psp $2500 \t");
scanf("\t %f",&CAN6);
printf ("\n\t 7.- psvita $3000 \t");
scanf("\t %f",&CAN7);
AR1=13500;AR2=12000;AR3=1200;AR4=1350;AR5=1000;AR6=2500;AR7=3500;
TO=(AR1*CAN1)+(AR2*CAN2)+(AR3*CAN3)+(AR4*CAN4)+(AR5*CAN5)+(AR6*CAN6)+(AR7*CAN7);
printf("\n su precio a pagar es de: \t %f",TO);
printf("\n 1.- si desea regrsar a la categoria de sony o 2.- regresar al menu principal ");
scanf("%d",COM);
}while(COM ='1');
}
}
else (SE ==2);{
exit(-1);}
} while ( SE != '2');
gotoxy (2,12);
}
//FUNCION GOTOXY
void gotoxy(int x,int y){
HANDLE hcon;
hcon = GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwPos;
dwPos.X = x;
dwPos.Y= y;
SetConsoleCursorPosition(hcon,dwPos);
}
//FUNCION QUE DIBUJA EL CUADRO
void dibujarCuadro(int x1,int y1,int x2,int y2){
int i;
for (i=x1;i<x2;i++){
gotoxy(i,y1); cout << "\304"; //linea horizontal superior
gotoxy(i,y2); cout << "\304"; //linea horizontal inferior
}
for (i=y1;i<y2;i++){
gotoxy(x1,i); cout <<"\263"; //linea vertical izquierda
gotoxy(x2,i); cout <<"\263"; //linea vertical derecha
}
gotoxy(x1,y1); cout<< "\332";
gotoxy(x1,y2); cout<< "\300";
gotoxy(x2,y1); cout<< "\277";
gotoxy(x2,y2); cout<< "\331";
}
Valora esta pregunta


0