/* Main program Queries various SNMP values on cisco devices. */ int main(int argc, char *argv[]) { char* output; struct snmp_session session; char arg; // int i; // long snmpVer; /* Initialize and build snmp session, add version, community, host, etc */ init_snmp("Linux_checks"); snmp_sess_init( &session ); switch (arg = snmp_parse_args(argc, argv, &session, "C:", optProc)) { case -3: exit(1); case -2: exit(0); case -1: usage(); exit(1); default: break; } /* Check warning/critical test values to verify they are within the appropriate ranges */ if ((crit > 100) && (strcmp(mode, "sessions"))) { printf("Critical threshold should be less than 100!\n"); usage(); exit(RESULT_UNKNOWN); } else if (crit < 0) { printf("Critical threshould must be greater than 0!\n"); usage(); exit(RESULT_UNKNOWN); } else if ((warn < 0) && (strcmp(mode, "sessions"))) { printf("Warning threshold must be greater than or equal to 0!\n"); usage(); exit(RESULT_UNKNOWN); } else if (warn > crit) { printf("Warning threshold must not be greater than critical threshold!\n"); usage(); exit(RESULT_UNKNOWN); } output = checkCPU(&session); printf("%s", output); return exitVal; }
int main(void) { int i; i = checkCPU(); if (i == 0) { printf("this is Big_endian\n"); } else if (i == 1) { printf("this is Little_endian\n"); } return 0; }
int main(int argc, char** argv) { setUseOptimized(true); checkCPU(); typecvtS2L();//型の変換 typecvtL2S(); addmullsingle(); shuffle_test(); cout<<"copy test"<<endl;vsOpenCV_copy(); cout<<"cvt test"<<endl;vsOpenCV_cvt(); cout<<"add test"<<endl;vsOpenCV_add(); cout<<"multiply test"<<endl;vsOpenCV_multiply(); cout<<"flip test"<<endl;vsOpenCV_flip(); cout<<"swap test"<<endl;vsOpenCV_swapRB(); cout<<"split test"<<endl;vsOpenCV_split(); cout<<"gray test"<<endl;vsOpenCV_BGR2Gray(); return 0; }
void main(){ int *p = (int*)0x22cc88; *p = NULL; printf("p = %p\n",p); //判断大端小端 int i=1; char *pm = (char*)&i; if(*pm==1){ printf("1\n");//小端模式 }else printf("2\n");//大端模式 /* 数值来说1是高位,4是地位 如果将一个16位的整数0x1234存放到一个短整型变量(short)中。这个短整型变量在内存中的存储在大小端模式由下表所示。 地址偏移 大端模式 小端模式 (低地址)0x00 12(OP0) 34(OP1) (高地址)0x01 34(OP1) 12(OP0) //由上表所知,采用大小模式对数据进行存放的主要区别在于在存放的字节顺序,大端方式将高位存放在低地址,小端方式将低位存放在低地址。 采用大端方式进行数据存放符合人类的正常思维,而采用小端方式进行数据存放利于计算机处理。 */ //请写一个C函数,若处理器是Big_endian的,则返回0;若是Little_endian的,则返回1 printf("%d\n",checkCPU());//小端模式 }
int main(){ litte_or_big(); checkCPU(); return 0; }
int main (int argc, char *argv[]) { othelloBoard board; int choice; cout << "Load a game or start a new one?\n"; cout << "1 -> Load a saved board state\n"; cout << "2 -> Start a new game\n"; bool validSelection = false; do { cout << "Selection: "; string str; cin >> str; istringstream iss(str); iss >> choice; if (iss.eof() == false) { cout << "Non-integer input, please try again." << endl; } else if(choice > 2 || choice < 0) { cout << "Integer selection out of range, please try again" << endl; } else { validSelection = true; } } while (!validSelection); othelloGame game (&board); if (choice == 1) game.newGame = false; bool whiteMovesFirst = false; bool cpu1; bool cpu2; float limit; if (game.newGame) { cpu1 = checkCPU(1); cpu2 = checkCPU(2); if (cpu1 || cpu2) { limit = getTimeLimit(); } cout << "New Game\n"; game.firstMove(); } else { string filename; cout << "Give filename of savefile: "; cin >> filename; game.loadGame(filename, whiteMovesFirst, limit); cpu1 = checkCPU(1); cpu2 = checkCPU(2); } heuristicEvaluation h; // humanPlayer, playerId, n, symbol player playerOne (!cpu1, 1, board.n,-1, h); // black player playerTwo (!cpu2, 0, board.n,1, h); // white if (cpu1 || cpu2) { playerOne.limit = limit; playerTwo.limit = limit; } if (whiteMovesFirst) { game.move(playerTwo); game.statusUpdate(); } while (!game.complete) { game.move(playerOne); // player one moves game.move(playerTwo); game.statusUpdate(); // updates value of game.complete }; }