Ejemplo n.º 1
0
void SearchWidget::findStation(const QString& str) {
	removeMatches();
	matchString(str.toStdString());

	removeContent();
	updateContent();
}
Ejemplo n.º 2
0
void SearchWidget::getSelectedStation() {
	removeMatches();

	QList<QTableWidgetItem*> selectedItems = _ui.resultTableWidget->selectedItems ();
	QList<QTableWidgetItem*>::iterator it = selectedItems.begin();
	for ( ; it != selectedItems.end(); it++ ) {
		QTableWidgetItem* item = *it;
		std::string station = item->text().toStdString();
		addMatch(station);
	}
}
Ejemplo n.º 3
0
int main()
{
    int bins[5];
    int turns = 1;;
    int i = 0;
    for(i = 0; i < 5; i++)
    {
        bins[i] = 7;
    }
    int matchesRemoved;
    int binNumber;
    while(checkGameEnd(bins, 5) == false)
    {
        displayGame(bins, 5);
        if(turns % 2 == 0)
        {
            printf("It is Player 2's turn\n");
        }
        else
        {
            printf("It is Player 1's turn\n");
        }
        printf("What bin do you want to remove matches from? (1-5)\n");
        scanf(" %d", &binNumber);
        binNumber -= 1;
        printf("How many matches do you want to remove? (1-7)\n");
        scanf(" %d", &matchesRemoved);
        if(removeMatches(binNumber, matchesRemoved, bins, 5) == false)
        {
            printf("Try again, please enter a legal move.\n");
            turns -= 1;
        }
        turns++;
    }
    if(turns % 2 == 0)
    {
        printf("Player 2 wins!\n");
    }
    else
    {
        printf("Player 1 wins!\n");
    }
}