All pastes #2095386 Raw Edit

loridaz

public text v1 · immutable
#2095386 ·published 2011-11-24 13:25 UTC
rendered paste body
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>

using namespace std;

int main()
{
	srand((unsigned int)time(0));
	int player=0, comp = 0;
	string coup[3] = {"pierre","papier","ciseau"};
	int manche = 0;

	cout << "Stavouet Entertainment Presents:"<<endl;
	cout << "Pierre, Papier, Ciseaux !" << endl << endl;
	cout << "combien de manche gagnante ? : ";
	cin >> manche;

	do
	{
		cout << "score:"<<endl <<"Player: "<< player<<"      Ordi: " << comp<<endl<<endl;
		cout << "1 pierre, 2 papier, 3 ciseau : ";
		int a=0;
		cin >> a;

		int b=0;
		b = 1 + rand()%3;

		cout << "Players : " << coup[a-1] << " vs " << coup[b-1] << " : Comp" << endl;
		if( a == b)
		{
			cout << "Egalite..." << endl<< endl;
			continue;
		}
		if( (a == 1 && b==3) || ( a==2 && b==1) || (a == 3 && b == 2))
		{
			player++;
			cout << "player gagne." << endl << endl;
		}
		else
		{
			comp++;
			cout << "ordi gagne." << endl<< endl;
		}
	} while( player != manche && comp != manche);
	cout << "score final:"<<endl <<"Player: "<< player<<"      Ordi: " << comp<<endl<<endl;
	if (player < comp)
		cout << "Ordi vainqueur..." << endl;
	else
		cout << "Player vainqueur..." <<endl;
}