CURSO DE C++ / CLASE 10

#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

int jugada;

int main()
{
	srand(time(NULL)); // Iniciamos la semilla random con la hora.
	jugada = (rand() % 3)+1; // Genera un valor entre 1 y 3.
    switch(jugada)
	{
		case 1:
			cout << "PIEDRA." << endl;
			break;
		case 2:
			cout << "PAPEL." << endl;
			break;
		case 3:
			cout << "TIJERA." << endl;
			break;
		}
	return 0;
}
#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

int jugada;

int main()
{
	srand(time(NULL));// Iniciamos la semilla random con la hora.
	jugada = (rand() % 3)+1; // Genera un valor entre 1 y 3.
	if(jugada==1)
	{
		cout << "PIEDRA." << endl;
	}
	else if (jugada==2)
	{
		cout << "PAPEL." << endl;		
	}
	else if (jugada==3)
	{
		cout << "TIJERA." << endl;		
	}
	return 0;
}