#include <stdio.h>
#include <stdlib.h>
/* Xogo quente quente frio frio sen utilizar else*/
int main ()
{
int numero_a_buscar = 0, encontrado = 0, dato_teclado = 0;
// Inicizase o xerador de números aleatorios
srand ( time(NULL) );
// Xeramos un número aleatorio entre 1 e 100
numero_a_buscar = (rand() % 100) + 1;
//printf("%d", numero_a_buscar);
while (encontrado == 0)
{
printf("\nIntroduce un numero a ver se acertas no que estou a pensar: ");
scanf("%d", &dato_teclado);
if (numero_a_buscar == dato_teclado)
{
printf("\nAcertaches. Noraboa.\n");
encontrado = 1;
}
if ((numero_a_buscar - dato_teclado >= -5) && (numero_a_buscar - dato_teclado < 0))
{
printf("\nQuente, moi quente, andaslle ahi.");
}
if ((numero_a_buscar - dato_teclado <= 5) && (numero_a_buscar - dato_teclado > 0))
{
printf("\nQuente, moi quente, andaslle ahi.");
}
if ((numero_a_buscar - dato_teclado >= -10) && (numero_a_buscar - dato_teclado < -5))
{
printf("\nTemperado.");
}
if ((numero_a_buscar - dato_teclado <= 10) && (numero_a_buscar - dato_teclado > 5))
{
printf("\nTemperado.");
}
if ((numero_a_buscar - dato_teclado >= -20) && (numero_a_buscar - dato_teclado < -10))
{
printf("\nFrio.");
}
if ((numero_a_buscar - dato_teclado <= 20) && (numero_a_buscar - dato_teclado > 10))
{
printf("\nFrio.");
}
if (numero_a_buscar - dato_teclado < -20)
{
printf("\nConxelado.");
}
if (numero_a_buscar - dato_teclado > 20)
{
printf("\nConxelado.");
}
}
return 0;
}