Playsound only when specific key is pressed

i am making a program in c++ but i want help in playsound fuction

i want a specific sound to be played only when a specific text is entered

for example
if i enter 'yes' or 'y'
then i want the sound to be heard after this text is entered

please help me and reply ASAP
thanking you all a lot
Use SFML.Use sf::SoundBuffer to load the sound file you what then use sf::Keyboard::isKeyPressed(sf::Keyboard::Y) to check if y is pressed then use sf::Sound to play it when you press the key.
Registered users can post here. Sign in or register to post.