dobrý den,
dělám program který pokud zmáčknu nějakou klávesu, tak zahraje nějaký tón
mam ale problém že po tom co zmáčknu klávesu tam musím dát enter.
proč?
tóny ještě nemám pojmenované a tak to zatím jenom pípá.
#include <cstdlib>
#include <iostream>
#include <windows.h>
#include <conio.h>
using namespace std;
int main(int argc, char *argv[])
{
while(1){
if(kbhit()){
switch(getchar()){
case 'q' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'w' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'e' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'r' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 't' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'z' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'u' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'i' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'o' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'p' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'a' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 's' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'd' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'f' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'g' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'h' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'j' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'k' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'l' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'y' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'x' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'c' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'v' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'b' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'n' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 'm' :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 1 :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 2 :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 3 :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 4 :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 5 :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 6 :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 7 :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 8 :
PlaySound("usetrimeZbytecnouOtazku.wav", NULL, SND_FILENAME | SND_ASYNC);
break;
case 9 :
break;
}
system("cls");
}}
system("PAUSE");
return EXIT_SUCCESS;
}