Você está na página 1de 2

/ PC1-E1.cpp: define el punto de entrada de la aplicacin de consola.

//Fecha 14 de Abril del 2015


//OBJETIVO: GENERAR VALORES E INDICAR SI CUATRO SON IGUALES O SI TRES SON IGUALES
O SI DOS Y DOS O SI DOS SON IGUALES Y SI SON TODOS DIFERENTES/*
#include "stdafx.h"
# include<iostream>
# include<conio.h>
# include<ctype.h>
# include<stdlib.h>
# include<time.h>
using namespace std;
void main ()
{ int v1,v2, v3, v4;
int c0,c1,c2,c3,c4,c5,c6;
rand();
v1 = rand()%14;
v2 = rand()%14;
v3 = rand()%14;
v4 = rand()%14;
cout<<v1<< " "<<v2<<" "<<v3<<" "<<v4<<endl;
c0 = ((v1==v3)&&(v3==v4));
c1 = ((v1==v2)&&(v2==v3));
c2 = ((v1==v2)&&(v2==v4));
c3 = ((v2==v3)&&(v3==v4));
c4 = ((v1==v2)&&(v3==v4));
c5 = ((v1==v3)&&(v2==v4));
c6 = ((v1==v4)&&(v2==v3));
if ( (v1== v2)&&(v2==v3)&&(v3==v4))
cout<<"Las cuatro son iguales"<<endl;
else
if(c0||c1||c2||c3)
cout<<"Tres son iguales"<<endl;
else
if(c4||c5||c6)
cout<<" Hay dos pares"<<endl;
else
if((v1==v2)||(v1==v3)||(v1==v4)||(v2==v3)||(v2==v4)||(v3==v4))
cout<<" Hay un solo par"<<endl;
else
cout<<"Todas son distintas"<<endl;
getch(); }

# include "stdafx.h"
# include<iostream>
# include<conio.h>
# include<ctype.h>
# include<stdlib.h>
# include<time.h>
void main ()
{ int v1,v2,v3,v4;
int c0,c1,c2,c3,c4,c5,c6;
rand();
v1 = rand()%13+1;
v2 = rand()%13+1;
v3 = rand()%13+1;
v4 = rand()%13+1;
cout<<v1<< " "<<v2<<" "<<v3<<" "<<v4<<endl;
c0 = ((v1==v3)&&(v3==v4));
c1 = ((v1==v2)&&(v2==v3));
c2 = ((v1==v2)&&(v2==v4));
c3 = ((v2==v3)&&(v3==v4));
c4 = ((v1==v2)&&(v3==v4));
c5 = ((v1==v3)&&(v2==v4));
c6 = ((v1==v4)&&(v2==v3));
if ( (v1== v2)&&(v2==v3)&&(v3==v4))
cout<<"Las cuatro son iguales"<<endl;
else
if(c0||c1||c2||c3)
cout<<"Tres son iguales"<<endl;
else
if(c4||c5||c6)
cout<<" Hay dos pares"<<endl;
else
if((v1==v2)||(v1==v3)||(v1==v4)||(v2==v3)||(v2==v4)||(v3==v4))
cout<<" Hay un solo par"<<endl;
else
cout<<"Todas son distintas"<<endl;
getch(); }

Você também pode gostar