Skip to content
Snippets Groups Projects
jokenpo.cpp 1.23 KiB
Newer Older
/**
 * @file       jokenpo.cpp
 * @author     Louise Stella    <louiselbarbosa@gmail.com> 
 * @version    1.0
 *
 * This is the implementation file for the jokenpo functions used on the Jokenpo library.
 *
 * Created for the "Linguagem de Programação I" class from the
 * Universidade Federal do Rio Grande do Norte em 24/06/2017.
 * 
 */

Louise's avatar
Louise committed
#include <iostream>
Louise's avatar
Louise committed
#include <ctime>
#include <cstdlib>
Louise's avatar
Louise committed
#include "../include/jokenpo.hpp"

using namespace std;

Louise's avatar
Louise committed
namespace jokenpo{
Louise's avatar
Louise committed

    int sum( int a, int b ){
        return ( a + b );
    }    

Louise's avatar
Louise committed
    int cpuMove(void){
        srand( time(0) );
        int cpuChoice = rand() % 3;
        return cpuChoice;
    }    

    int jokenpo(void){

        string greeting = "Let's play ROCK-PAPER-SCISSORS!";
        print(greeting);

        int option = 0;

        string choices = "If you want to choose 'Rock', type '1'. IF you want 'Paper', type '2'. And if you want 'Scissors', type '3'.";
        print(choices);
        cin >> option;

        string playerMove = "Your play was: ";
        print(playerMove);
        print(option);

        string opponentMove = "And my play was: ";
        print(opponentMove);
        int SarumanMove = cpuMove();
        print(SarumanMove);

        return 0;

    }


Louise's avatar
Louise committed
}