コード例 #1
0
void Table::print() {
    minCol = 102;
    minRow = 102;
    maxRow = 0;
    maxCol = 0;
    for (int i = 0; i != 103; i++) {
        for (int j = 0; j != 103; j++) {
            if (board[i][j] == 1) {
                if (minRow == 102)
                    minRow = i;
                if (minCol > j)
                    minCol = j;
break;}}}
    for (int i = 102; i != -1; i--) {
        for (int j = 102; j != -1; j--) {
            if (board[i][j] == 1) {
                if (maxCol < j)
                    maxCol = j;
                if (maxRow == 0)
                    maxRow = i;
                break;}}}
    if (minCol != 0)
        minCol--;
    if (maxCol != 102)
        maxCol++;
    if (minRow != 0)
        minRow--;
    if (maxRow != 102)
        maxRow++;
    if (maxRow < minRow || maxCol < minCol)
        cout << "Empty table!!" << endl;
    else {
        cout << "   ";
        for (int k = minCol; k != maxCol + 1; k++) {
            cout << k << "  ";}
        cout << endl;
        for (int i = minRow; i != minRow + (maxRow - minRow + 1) * 3; i++) {
            if ((i - minRow) % 3 == 0)
                cout << i - 2 * ((i - minRow) / 3) << " ";
            else
                cout << "   ";
            for (int j = minCol; j != maxCol; j++) {
                if ((i - minRow) % 3 == 2)
                    cout << "  ";
                else {
                    if (board[minRow + (i - minRow) / 3][j] == 1)
                        cardBoard[minRow + (i - minRow) / 3][j]->printRow(
                            EvenOdd((i - minRow) % 3));
                    else
                        cout << "  ";}
                        cout << "  ";}
                        cout << endl;}}}
コード例 #2
0
main()
{
	struct node *start1=NULL,*start2=NULL,*start3=NULL;	
	start1=create_list(start1);
	display(start1);
	EvenOdd(start1, &start2, &start3);
	printf("List L1 is :\n");
	display(start1);
	printf("List L2 is :\n");
	display(start2);
	printf("List L3 is :\n");
	display(start3);
}/*End of main()*/
コード例 #3
0
ファイル: FontWin32.cpp プロジェクト: dreamsxin/ultimatepp
void Painter::CharacterOp(double x, double y, int ch, Font fnt)
{
	PAINTER_TIMING("CharacterOp");
	String s;
	INTERLOCKED {
		static LRUCache<String, FontChar> cache;
		cache.Shrink(100000);
		sMakeCharOutline h;
		h.fc.fnt = fnt;
		h.fc.chr = ch;
		s = cache.Get(h);
	}
	RenderCharPath(s, s.GetLength(), *this, x, y + fnt.Info().GetAscent());
	EvenOdd(true);
}
コード例 #4
0
ファイル: Painter.cpp プロジェクト: dreamsxin/ultimatepp
void Painter::DrawTextOp(int x, int y, int angle, const wchar *text, Font font, Color ink, int n, const int *dx)
{
	Begin();
	EvenOdd(true);
	if(angle)
		Rotate(angle * M_2PI / 36000);
	if(n < 0)
		n = wstrlen(text);
	double *ddx = NULL;
	Buffer<double> h;
	if(dx) {
		h.Alloc(n);
		ddx = h;
		for(int i = 0; i < n; i++)
			ddx[i] = dx[i];
	}
	Text(x, y, text, font, n, ddx);
	Fill(ink);
	End();
}