Esempio n. 1
0
// @Module: Main
int main(void) {

// Load puzzle-pieces:
	int i;Piece piece;int nPieces=sizeof(piecesStr)/11;
	printf("%d pieces\n",nPieces);
	for (i=0;i<nPieces;++i) {
		piece=strToInt64(piecesStr[i]);
		pushPiece(piece);
#ifdef VERBOSE
		printPiece(piece);
		printf("---\n");
		printPiece(flip(piece));
		printf("---\n");
		printPiece(rot(piece));
		printf("---\n");
		printPiece(flipRot(piece));
		printf("---\n");
		printf("~-~\n");
#endif
	}

	printf("STarTing::\n---!!\n");
	if (!tryNextPiece(0)) {
		printf("No solution!\n");
		return -1;
	}
	printf("Solved!");
	return 0;
}
bool
stringToInt64(const string& s, Int64& result)
{
    const char* start = s.c_str();
    char* end = 0;
    errno = 0;
    result = strToInt64(start, &end, 0);
    return (errno == 0 && start != end);
}
Esempio n. 3
0
        void setOption(int c, string& option_arg) {

            BasePlotArgs::setOption(c, option_arg);

            switch(c)
            {
            case 'x':
                x_max = strToInt16(optarg);
                break;
            case 'y':
                y_max = strToInt64(optarg);
                break;
            case 'a':
                ignore_absent = true;
                break;
            case 'm':
                max_duplication = strToInt16(optarg);
                break;
            case 'c':
                columns = string(optarg);
                break;
            }
        }
Esempio n. 4
0
//-----------------------------------------------------------------------------
// 描述: 以64位整型返回字段值 (若转换失败则返回缺省值)
//-----------------------------------------------------------------------------
INT64 DbField::asInt64(INT64 defaultVal) const
{
    return strToInt64(asString(), defaultVal);
}