[ create a new paste ] login | about

Link: http://codepad.org/MZxazXoW    [ raw code | output | fork ]

hmurcia - C++, pasted on Mar 18:
#include <iostream>
#include "mylib.h"
using namespace std;

struct Triqui {
    char x[3][3];   // tablero de juego
    char av[2];     // avatar de cada jugador
    char *jug1, *jug2;  // nombres de los jugadores
    short turno;   //  1 o 2
    void verTablero();
    bool casillaOcupada(short, short);
    void leeMovim();
    void cambiaTurno();
    void leeNombres();
    void leeAvatares();
    bool hayTriqui();
    bool tableroLleno();
};

int main() {
    Triqui juego;
    juego.verTablero();
    juego.turno = 1;
    juego.leeNombres();
    juego.leeAvatares();
    do {
        juego.cambiaTurno();
        juego.leeMovim();

    } while (!juego.hayTriqui() && !juego.tableroLleno());
    system("pause>nul");
}

void Triqui::verTablero()  {
    cout << "JUEGO DE TRIQUI\n\n"
        << "_  _  _\n\n_  _  _\n\n_  _  _\n\n";
}

void Triqui::leeMovim()  {
    short x, y;
    do {
        cout << "Ingrese fila y columna de su jugada: ";
        cin >> x >> y;
    } while (x<0 || y<0 || x>3 || y>3 || casillaOcupada(x, y) );
    this->x[x][y] = av[turno-1];   // guarda la jugada
    gotoxy(3*(y-1), 2*x);    cout << av[turno-1];
}

void Triqui::cambiaTurno() {

}

void Triqui::leeNombres()  {

}

void Triqui::leeAvatares()  {
    cout << "Ingrese avatares 1er y 2\xf8 jugador: ";
    cin >> av[0] >> av[1];
}

bool Triqui::hayTriqui()  {
    return true;
}

bool Triqui::casillaOcupada(short x, short y) {
    bool r = this->x[x][y] == av[0] || this->x[x][y] == av[1];
    return r;
}

bool Triqui::tableroLleno()  {
    return true;
}


Output:
1
2
3
4
Line 18: error: mylib.h: No such file or directory
t.cpp: In member function 'void Triqui::leeMovim()':
Line 46: error: 'gotoxy' was not declared in this scope
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: