jueves, 13 de octubre de 2016

PRÁCTICA 3, ESTRUCTURAS DE CONTROL DE FLUJO SELECTIVAS

#include <iostream>
#include <conio2.h>
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
#define maxfil 20
#define maxcol 80
#define maxcolor 16
int main() {
srand(time(NULL));
char resp;
int columna,fila;
int color;
cout<<"Desea ejecutar el programa s/n:";
cin>>resp;
clrscr();
columna = rand()%maxcol+1;
fila = rand()%maxfil+1;
color = rand()%maxcolor;
textcolor(color);
gotoxy(columna,fila);
printf("%c",char(219));
if (fila<10)
{
textcolor(WHITE);
gotoxy(20,20);
cout<<"ZONA SUPERIOR"<<endl;
}
else
{
textcolor(WHITE);
gotoxy(50,20);
cout<<"ZONA INFERIOR"<<endl;
}
if (columna>40)
{
textcolor(WHITE);
gotoxy(10,1);
cout<<"ZONA DERECHA"<<endl;
}
else
{
textcolor(WHITE);
gotoxy(50,17);
cout<<"ZONA IZQUIERDA"<<endl;
}
if (color==0)//Case 0:
{
textcolor(WHITE);
gotoxy(32,23);
cout<<"COLOR NEGRO"<<endl;
}
else{//case 1
if (color==1)
{
textcolor(WHITE);
gotoxy(32,23);
cout<<"COLOR AZUL"<<endl;
}
else{//case 2
if (color==2)
{
textcolor(WHITE);
gotoxy(32,23);
cout<<"COLOR VERDE"<<endl;
}
else{//case 3
if (color==3)
{
textcolor(WHITE);
gotoxy(32,23);
cout<<"COLOR CELESTE"<<endl;
}
else{//case 4
if (color==4)
{
textcolor(WHITE);
gotoxy(32,23);
cout<<"COLOR ROJO"<<endl;
}
else{//case 5
if (color==5)
{
textcolor(WHITE);
gotoxy(32,23);
cout<<"COLOR FUCSIA"<<endl;
}
else{//case 6
if (color==6)
{
textcolor(WHITE);
gotoxy(32,23);
cout<<"COLOR MARRON"<<endl;
}
else{//case 7
if (color==7)
{
textcolor(WHITE);
gotoxy(32,23);
cout<<"COLOR GRIS CLARO"<<endl;
}
else{//case 8
if (color==8)
{
textcolor(WHITE);
gotoxy(32,23);
cout<<"COLOR GRIS OSCURO"<<endl;
}
else{//case 9
if (color==9)
{
textcolor(WHITE);
gotoxy(32,23);
cout<<"COLOR AZUL CLARO"<<endl;
}
else{//case 10
if (color==10)
{
textcolor(WHITE);
gotoxy(32,23);
cout<<"COLOR VERDE CLARO"<<endl;
}
else{//case 11
if (color==11)
{
textcolor(WHITE);
gotoxy(32,23);
cout<<"COLOR CELESTE CLARO"<<endl;
}
else{//case 12
if (color==12)
{
textcolor(WHITE);
gotoxy(32,23);
cout<<"COLOR ROJO CLARO"<<endl;
}
else{//case 13
if (color==13)
{
textcolor(WHITE);
gotoxy(32,23);
cout<<"COLOR FUCSIA CLARO"<<endl;
}
else{//case 14
if (color==14)
{
textcolor(WHITE);
gotoxy(32,23);
cout<<"COLOR AMARIILLO"<<endl;
}
else{//case 15
if (color==15)
{
textcolor(WHITE);
gotoxy(32,23);
cout<<"COLOR BLANCO"<<endl;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}

system("PAUSE");
return(0);

}

No hay comentarios:

Publicar un comentario