Write code of game:Dots_boxes
-
my mainwindow.h:
@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include<QPushButton>
#include <QMainWindow>
#include <QSpinBox>
namespace Ui {
class MainWindow;
}class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
QPushButton **line;private slots:
};
#endif // MAINWINDOW_H
@my mainwindow.cpp:
@
#include "mainwindow.h"
#include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);for(int t=0;t<11;t++) { for(int i=0;i<10;i++) { line[i]=new QPushButton("h",this); line[i]->setGeometry(i*40,t*40,50,10); } } for(int t=0;t<10;t++) { for(int i=0;i<11;i++) { line[i]=new QPushButton("v",this); line[i]->setGeometry(i*40,t*40,10,50); } }
}
MainWindow::~MainWindow()
{
delete ui;
}
@my main.cpp:
@
#include "mainwindow.h"
#include <QApplication>int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.showMaximized();return a.exec();
}
@
==> we must have two player that clicke in every time on one pushbutton :if player 1->color pushbutton red:if
player 2->color pushbutton blue.
if four pushbutton in triangle color-->last player's clicke add one his score!
every one that must score -->winner in game
I want you help me and complete this code![andreyc EDIT]: Added @ around the code and moved it to Jobs forum
-
Looks like a follow-up of "this":https://qt-project.org/forums/viewthread/42234/
-
I guessed as much: a homework assignment. I guess that also means that you're not willing to shell out about 1000€ for it either. Anyway, I can't do it in that short a timeframe.
As this is homework, it is intended for you to learn from. Asking somebody else to do the work for you won't teach you anything. If it needs to be done tomorrow, you better get started, and order in a load of cola/red bull/coffee to keep you awake during the night...
-
Qt is C++, so what's your problem then? If it only takes you two hours, there's no need to worry for tomorrows deadline, is there?
The site you need, you have already found. There is excellent documentation to be found on Qt here, as well as lots of valuable FAQ articles, blog posts, and forum topics. What else do you need?