//----------------------------------------------------------------------------- // ¨ú±oÁä½L±½´yµ²ªG, Áä¤Jªº¦r¤¸·|¥X²{¦bconsoleµøµ¡¤W ENUM_AKCodes getakcodee() { int ik1 = _getche(); int ik2 = (ik1 == 0x00 || ik1 == 0xe0) ? _getche() : ik1; return convakcode(ik1, ik2); }
int main() { //BYTE user[USER_ACCOUNT_LENGTH]; system("COLOR 0A"); PrintAdapter(); printf("\n Modified By CCAV\n\n"); printf("-----------------------------------------------------\n\n"); printf("按任意键开始分析密码\n"); _getche(); system("CLS"); if(!ParaseH3CDataFile()) { printf("按任意键开始手动解析\n"); printf("--------------------------------------------------------------------\n"); _getche(); system("CLS"); ParaseByUser(); } printf("按任意键退出\n"); _getche(); return 0; }
int _tmain(int argc, _TCHAR* argv[]) { _cputs(buffer); _putch('\r'); _putch('\n'); _cputs(buffer1); //Displays buffer1 message a = _getche(); //Puts first input in variable a //Accounts for multiple numbered inputs while(a>='0' && a <= '9') { _asm sub a, 30h;// b = b * 10 + a; a = _getche(); } _putch('\r'); _putch('\n'); _cputs(buffer2); //Displays buffer2 message c = _getche(); //Puts second input in c //Accounts for multiple numbered inputs while(c>='0' && c <= '9') { _asm sub c, 30h;// d = d * 10 + c; c = _getche(); } _putch('\r'); _putch('\n'); //Calls the subtraction function sub(b,d); _putch('\r'); _putch('\n'); getche(); return 0; }
/* Application */ int main() { Tqueue queue; Tboolean succeed; char chr; initialize_queue(&queue); printf("\nEnter a letter to be queued "); printf("\nor digit 1 to dequeue a letter"); printf("\nor Return to quit a program\n"); chr = _getche(); while (chr != '\n' && chr != '\r') { if (isalpha(chr)) { succeed=enqueue(&queue, chr); print_queue(&queue); if (!succeed) printf("\n Enqueue operation failed\n"); } if (chr == '1') { succeed = dequeue(&queue, &chr); if (succeed) { printf("\na letter dequeued %c ", chr); print_queue(&queue); } else printf("\nDequeue operation failed\n "); } chr = _getche(); } }
int main(void){ int n, i, t, end, big, location=0; int ar[size]; do{ printf("\n Vuvedete golemina na masiva n="); scanf_s("%d", &n); if (n>1000 || n<0){ printf("\n\n Nekorekten razmer na masiva !!! "); printf("\n\n za povtorno vuvejdane, natisnete proizvolen klavi6 "); getch(); } } while (n>1000 || n <= 0); for (i = 0; i<n; i++){ printf("\n Vuvedete stoinost za ar[%d]=", i); scanf_s("%d", &ar[i]); } big = ar[0]; for (i = 1; i<n; i++){ if (ar[i]>big){ big = ar[i]; location = i; } } printf("\n nai golqmata stoinost v masiva e: %d\n\n", big); printf("\n nai - golqmata stoinost stoi v ar[%d]", location); _getche(); return 0; }
int main() { sout << locker << "\n Console Receiver Demo " << "\n =======================\n" << unlocker; try { EndPoint rep("127.0.0.1",8081); //EndPoint sep("127.0.0.1",2049); // MsgReceiver_Proc is your receiver's server message handling // FileReceiver_Proc is your receiver's server file handling Communicator rcvr(rep); MsgHandler<MsgReceiver_Proc> rMsgHandler; rMsgHandler.setCommunicator(&rcvr); rcvr.attachMsgHandler(&rMsgHandler); FileHandler<FileReceiver_Proc> rFileHandler; rFileHandler.setFileDestination(".\\debug"); rFileHandler.setCommunicator(&rcvr); rcvr.attachFileHandler(&rFileHandler); rcvr.listen(); sout << "\n\n press key to exit: "; sout.flush(); _getche(); sout << "\n\n"; rcvr.disconnect(); } catch(std::exception& ex) { sout << locker << "\n " << ex.what() << "\n\n" << unlocker; } }
int main(int argc,const char* argv[]) { clientSetup = new ClientSetup(); //If the returned value is not 0, there are problems with WSAStartup and Socket Opening/Binding if(clientSetup->initializeServer() != 0) { printf("Could not start the server. We're really sorry.\n"); return 0; } else { ////Part 1. Receive the JAUS message from Subsytem 1 ////Receiving the message //char* msg = clientSetup->receiveMessage(JAUS_MESSAGE_HEADER_LENGTH // + SET_WRENCH_EFFORT_LENGTH); //UINT16 command_code = endian_change_u16((msg[2] << 8) | msg[3]); //SetWrenchEffortMessage * swe; ////SetWrenchEffort //if(command_code == 1029) { // // printf("\nSet Wrench Effort"); // printf("\n----------------------------------------"); // swe = (SetWrenchEffortMessage *) msg; // printSetWrenchEffort(*swe); //} // ////Part 2. Transfer the JAUS packet to functions.cpp and concatenate the packet into ethercat datagram data //jaus_packet = msg; //jaus_packet_length = JAUS_MESSAGE_HEADER_LENGTH + (int)swe->jausMsgHdr.DataControl; } int c; raw_soc = new RawSoc(interf); // Print opening line, greeting, instructions, copyright notice etc. init_msg(); do // Main loop. { printf("\nEcat test:"); // Prompt user for input c = _getche(); //Get user response. putchar('\n'); // Take various actions based on user's response. int i; // Start scanning the array, looking for a match with input and ".key" member Only 'q' will have a zero for f for (i = 0; kcd[i].key != 0; i++) { if (c == kcd[i].key) { if (kcd[i].f != 0) kcd[i].f(); break; } } if (kcd[i].key == 0) top_menu(); //No match, print menu } while (c != 'q'); // End of main loop. delete raw_soc; // return 0; }
void main() { FILE *fp = NULL; setlocale(LC_ALL, "Russian"); for (;;) { showStatusBar(); showMenu(fp); switch(_getche()) { case '1': fp = openFile(fp); break; case '2': if (fp != NULL) fileAnalyze(fp); break; case '3': puts("Осторожно, прога закрывается без предупреждений!"); if (fp != NULL) fclose(fp); exit(1); default: puts("Была нажата клавиша."); break; } } }
int _tmain(int argc, _TCHAR* argv[]) { int signal1 [] = {1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1}; //User defined signal1 int signal2 [] = {1, 0, -1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1}; //User defined signal2 int signal3 [] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; //Temporary empty signal array //Adds signal 1 and signal 2. add_signals(signal1, signal2, signal3, LEN); //Finds the periods of all 3 signals. int p1 = find_period(signal1, LEN); int p2 = find_period(signal2, LEN); int p3 = find_period(signal3, LEN); printf("\nChris Whiting\n"); printf("\nSignal 1: "); print_vector(signal1, LEN); printf("\nSingal 1's period: %d samples", p1); printf("\nSignal 2: "); print_vector(signal2, LEN); printf("\nSingal 2's period: %d samples", p2); printf("\nSignal 1 + Signal 2: "); print_vector(signal3, LEN); printf("\nSingal 1+2's period: %d samples", p3); _getche(); return 0; }
void goMenu(){ switch(_getche()){ case '1': add(Mandarine); break; case '2': add(Peach); break; case '3': add(Grape); break; case '4': if (!(Bin[Mandarine].Weight == 0 && Bin[Peach].Weight == 0 && Bin[Grape].Weight == 0)) showBin(); break; case '5': if (!(Bin[Mandarine].Weight == 0 && Bin[Peach].Weight == 0 && Bin[Grape].Weight == 0)) showPrice(); break; case '6': about(); break; case '7': exit(0); break; default: system("cls"); printf("Вы промазали. Будьте впредь точнее!\n"); system("pause"); break; } }
/** * @brief Función para mostrar las opciones del programa * */ void menu() { setColor(WHITE); hidecursor(); char opcion; char texto[] = { "Acerca de este programa : \n\nEl programa que usted esta usando es de tipo estadistico y sirve de herramienta para el analisis de datos obtenidos de alguna encuesta o censo\nUsted obtendra la tabla de frecuencias que incluye la \"Frecuencia\", \"Frecuencia acumulada\", \"Frecuencia relativa\" y \"Frecuencia relativa acumulada\" de una muestra de datos ingresados por usted.\n\nComo usar:\n\nPara comenzar a utilizar el programa, es necesario que usted se dirija al menu principal, y seleccione, \"iniciar\", el sistema le pedira que ingrese el nombre de la variable, solo y unicamente en ese justo momento es posible que usted pueda cancelar la accion presionando la combinacion de telcas \"CONTROL+C\" ya que despues no sera posible, despues usted ingresara los datos uno por uno, despues de haber ingresado un dato el sistema mostrara un mensaje que le dara las opciones de continuar ingresando datos presionando la tecla ENTER, o dejar de ingresar datos presionando la tecla ESCAPE\n\n " }; system("cls"); puts("\n\tPrograma de estadistica\n"); puts("a. Ayuda"); puts("b. Iniciar"); puts("c. Demo"); puts("d. Salir"); printf(":"); opcion = _getche(); fflush(stdin); switch (opcion) { case 'a': system("cls"); puts("\n\tPrograma de estadistica\n\n"); printf("%s", texto); setColor(LIGHTMAGENTA); printf("\nAutor: Luis %cngel De Santiago Guerrero\n", A); printf("Matricula: ES1611300455\n"); printf("Contacto: [email protected]\n"); printf("Universidad Abierta y a Distancia de M%cxico\n", e); printf("Ingenier%ca en Desarrollo de Software\n\n", iacen); system("pause"); main(); break; case 'b': ingresoDeDatos(); break; case 'c': demo(); break; case 'd': printf("\n\n\t\t\tAdios"); puntitos(500, 3); exit(0); break; default: setColor(RED); printf("\nIngrese una opcion valida\n"); system("pause"); main(); break; } }
int LireNbreFilmValide(void) { int NbrFilms; cout << "Nombre de film lou\x82s (1 \x85 3) : "; int CurrX = wherex(); int CurrY = wherey(); do { gotoxy(CurrX,CurrY); NbrFilms = ConvertireUnCharEnInt(_getche()); } while(NbrFilms > 3 || NbrFilms < 1); return NbrFilms; }
void take_turn() { my_pick = '0'; while (my_pick != ACTION_CONTINUE && my_pick != ACTION_STOP) { std::cout << "What to do? [C]ontinue or [Q]uit : "; my_pick = _getche(); if (my_pick == 'C') my_pick = ACTION_CONTINUE; if (my_pick == 'Q') my_pick = ACTION_STOP; std::cout << std::endl; } return; }
static int msvcrt_getche_impl(PyModuleDef *module) /*[clinic end generated code: output=8aa369be6550068e input=43311ade9ed4a9c0]*/ { int ch; Py_BEGIN_ALLOW_THREADS ch = _getche(); Py_END_ALLOW_THREADS return ch; }
/* pergunta ao utilizador se existe um segundo proponente*/ int existeSegundoProponente(){ char proponentes; printf("%61s", " "); printf("Existe segundo proponente: (s/n)"); proponentes = _getche(); printf("\n"); if (proponentes == 's' || proponentes == 'S'){ return 1; } else return 0; }// fim função
void server_frame::run() { if(!init()) { fini(); LOG_ERROR("init fail."); #ifdef _WIN32 _getche(); #else int c; cin >> c; #endif return; }
int PauseAndContinue() { if (_kbhit()) { int c = _getche(); if (c != 'q' && c != 'Q') { WaitForKey(); } else return 0; } return 1; }
static PyObject *msvcrt_getche(PyObject *self, PyObject *args) { int ch; char s[1]; if (!PyArg_ParseTuple(args, ":getche")) return NULL; Py_BEGIN_ALLOW_THREADS ch = _getche(); Py_END_ALLOW_THREADS s[0] = ch; return PyString_FromStringAndSize(s, 1); }
int main() { ip = 0; op = 0; n = 0; int ret; char chr; char c; printf("功能选择:ESC 退出:- 输出一个字符;+ 打印当前队列;0-9、A-Z进入队列,其他抛弃。\n"); while (1) { c = _getche(); if (c == 0x1B) { break; } if (c == '-') { ret = oq(buf, &op, &chr); if (ret == 0) { printf("\nEMPTY!\n"); } else { printf("输出元素为:%c\n", chr); } continue; } if (c == '+') { printf("\n当前队列内容:"); pq(buf, ip, op); printf("队首下标:%d 队尾下标:%d\n", op, ip); continue; } if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z')) { ret = iq(buf, &ip, c); if (ret == 0) { printf("\nFULL!\n"); } continue; } } return 0; }
int main() { printf("请输入数字或大写字母,或者'+','-',或者ESC退出\n"); chr = _getche(); while (chr != 0x1b) { if (chr == '-') { oq(bufdasm, &op, &chr); if (chr != '-') printf("提取的元素为:%c\n", chr); } else if (chr == '+') { printf("\n当前队列内容为:"); pq(bufdasm, ip, op); printf("队首下标为:%d 队尾下标为:%d 元素个数为:%d\n", op, ip, n); } else if ((chr >= '0' && chr <= '9') || (chr >= 'A' && chr <= 'Z')) iq(bufdasm, &ip, chr); chr = _getche(); }; return 0; };
/*---------------------------------------------------------------------- * Prompt for the state to put the flip flop(s) in */ short WhichFlipFlop(short channels) { short rt = 0,i; printf("\n"); for (i = 0; i < channels; i++) { printf("Channel %c Flip Flop (1 set, 0 clear):",'A' + i); if (_getche() == '0') rt |= (0x01 << i); printf("\n\n"); } return (rt << 5) | 0x1F; }
void main(){ int change, finish = 0; start: srand(1995); createNewGame(); generateNumber(NULL); char c = _getch(); while (c != 'x'){ change = 0; if (c == 'w') change = up(); else if (c == 's') change = down(); else if (c == 'a') change = left(); else if (c == 'd') change = right(); if (change) finish = generateNumber(c); else printf("\nINVALID"); if (finish) c = 'x'; else c = _getch(); } printf("\n\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GAME OVER ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "); printf("\n\n Your Score : %6d", score); printf("\n\n Do you want to play again ? (Y/N) : "); exit: c = _getche(); if (c == 'y' || c == 'Y') goto start; else if (c == 'n') credits(); else{ printf("\b"); goto exit; } _getch(); }
void WaitForSart(const char* str, int sec, int pos_x) { for(int i=sec*1000; i>0; i-=1000) { printf("%s: %d ", str, i/1000); Sleep(1000); COORD pos = {0, pos_x}; SetConsoleCursorPosition(hStdout, pos); if(_kbhit()) { _getche(); printf("\n"); break; } } }
int Test() { int ret; //Create Network media component and start listen events. //4059 is Official DLMS port. /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. CGXDLMSServerSN SNServer; if ((ret = SNServer.Init(4060)) != 0) { return ret; } printf("Short Name DLMS Server in port 4060.\r\n"); /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. CGXDLMSServerLN LNServer; if ((ret = LNServer.Init(4061)) != 0) { return ret; } printf("Logical Name DLMS Server in port 4061.\r\n"); /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. CGXDLMSServerSN_47 SN_47Server; if ((ret = SN_47Server.Init(4062)) != 0) { return ret; } printf("Short Name DLMS Server with IEC 62056-47 in port 4062.\r\n"); /////////////////////////////////////////////////////////////////////// //Create Gurux DLMS server component for Short Name and start listen events. CGXDLMSServerLN_47 LN_47Server; if ((ret = LN_47Server.Init(4063)) != 0) { return ret; } printf("Logical Name DLMS Server with IEC 62056-47 in port 4063.\r\n"); printf("Press ESC to close application.\r\n"); #if defined(_WIN32) || defined(_WIN64)//Windows while ((_getche()) != 27); #else while (getchar() != '\033'); #endif return 0; }
int main(int argc, char* argv[]) { ConsoleGame game; if( game.Init() ) { while( game.MainLoop() ) { } } else { std::cout << "\nFailed Initialisation, press a key to exit.\n"; _getche(); } std::cout << "Exiting...\n"; return 0; }
/* * Windows does console slightly different then then unix case. */ static int read_string(const char *preprompt, const char *prompt, char *buf, size_t len, int echo) { int of = 0; int c; char *p; void (*oldsigintr)(int); _cprintf("%s%s", preprompt, prompt); oldsigintr = signal(SIGINT, intr); p = buf; while (intr_flag == 0) { c = ((echo) ? _getche() : _getch()); if ((c == '\n') || (c == '\r')) { break; } if (of == 0) { *p++ = c; } of = (p == buf + len); } if (of) { p--; } *p = 0; if (echo == 0) { printf("\n"); } signal(SIGINT, oldsigintr); if (intr_flag) { return (-2); } if (of) { return (-1); } return (0); }
void CaptureFrame(Mat & detectImg){ VideoCapture captureDevice; captureDevice.open(0); if (!captureDevice.isOpened()){ cout << "Camera not found!"; } else{ char kbCmd = ' '; captureDevice >> detectImg; int w = detectImg.cols, h = detectImg.rows; bool finish = false; while (!finish){ captureDevice >> detectImg; detectImg = detectImg(Rect(120, 40, 400, 400)); imshow("Capture", detectImg); cvWaitKey(33); if (_kbhit()) kbCmd = _getche(); if (kbCmd == 'c') break; } destroyAllWindows(); } //VideoCapture captureDevice; //captureDevice.open(0); //if (!captureDevice.isOpened()){ // cout << "Camera not found!"; //} //else{ // char kbCmd = ' ', name[30]; // captureDevice >> captureImage; // int w = captureImage.cols, h = captureImage.rows; // bool finish = false; // while (!finish){ // setMouseCallback(window_name, onMouse, 0); // captureDevice >> captureImage; // finish = DisplayInfo(captureImage); // if (_kbhit()) kbCmd = _getche(); // if (kbCmd == 'c') break; // } // destroyAllWindows(); //} }
int main(){ float suma = 0,sr,n,arr[SIZE]; int i,num = 0; printf("\n Vuvedete golemina na masiva: "); scanf_s("%f", &n); for (i = 0; i<n; i++){ printf("\n Vuvedete stoinost za ar[%d]: ", i); scanf_s("%f", &arr[i]); suma += arr[i]; } printf("\nSuma = %.2f", suma); sr = sredno(suma, n); printf("\nSredna stoinost = %.2f", sredno(suma, n)); _getche(); return 0; }
void GenData::createFiles() { //int blk_len = 4096; char txtfile[100]; int data_size; //=atoi(argv[2]); char gen_code; //=argv[3][0]; char fName[100]; int rand_seed = 0; std::vector<std::vector<float>> data; //DATA GENERATOR //-------------- printf("Give the desired File Name:"); scanf("%s", fName); printf("Give the desired Data Size:"); scanf("%d", &data_size); //data_size = 10; printf("Give the desired Distribution (i/c/a):"); gen_code = _getche(); //gen_code = 'i'; printf("\nGive the desired dimensions:"); scanf("%d", &data_dim); //data_dim = 2; //sprintf(rtfile,"data/%s.rtr",argv[1]); //sprintf(dtfile,"data/%s.dt",argv[1]); //sprintf(txtfile, "Data/%s.bin", fname); // Initialize random generator srand(rand_seed); srand(rand_seed); // Generate the data gen_syn_data(data, data_size, gen_code, fName); // Write the data to a txt file // Create the R-Tree //createRTree(data); printf("\nDataSet and Files successfully created in Folder <Data>.\n"); }
void kayıt_görüntüle(FILE *fptr) { fptr = fopen("rehberim.txt", "r"); //Okuma modunda açıyoruz int Secim; if (fptr == NULL)//Dosya açılmassa(daha önce açılmış ve silinmişse veya açma işlemi gerçekleştirilmemişse) NULL değeri gelir { while (1) { printf("Suan rehberinizde hickimse ekli degil ekleme yapmak icin (E) tusuna basiniz : ");//Rehber oluşturulamamışsa veya daha önce silinmişse bu uyarı gösterilir Secim = _getche(); system("cls"); if (Secim == 'e' || Secim == 'E') { kayıt_ekle(fptr); break; } else { printf("\n"); printf("Yanlis secim yaptiniz! Lutfen belirtilen tuslari kullaniniz\n"); Sleep(2500); exit(1); } } } else // Dosya önceden varsa kisi eklenebilir { system("cls"); printf("********************************************************************************************************"); printf("\n\t\t\t\t KISI GORUNTULE\n"); printf("********************************************************************************************************\n\n"); printf("Telefon Rehberinde ekli olan tum kisileri goruntuluyorsunuz \n\n"); while (fscanf(fptr, "%s%s%s%s%s%s%s", &rehber.ad, &rehber.soyad, &rehber.dtarih, &rehber.eposta, &rehber.evtel, &rehber.istel, &rehber.ceptel) != EOF)//Dosya sonu belirteci EOF a kadar okunur ve ekrana yazdırılır. { printf("Ad: %s\nSoyad: %s\nD.Tarihi: %s\nE-Posta: %s\nEv Telefonu: %s\nIs Telefonu: %s\nCep Telefonu:%s\n\n", rehber.ad, rehber.soyad, rehber.dtarih, rehber.eposta, rehber.evtel, rehber.istel, rehber.ceptel); } fclose(fptr);//Dosyayı kapatıyoruz system("pause"); //İşleme devam edip etmeyeceği sorgulanmıştır. baskaislem(); } }