For my programming class I am attempting to make a soundboard of 5 sounds. A user can type in a number 1-5 to play a specific sound. I am quite new to programming so I have been looking online for help and I found a solution that gives me no errors except the sound still does not play. I do not know if my code is even good. I am not asking for someone to write me a code more looking for some hints or tips on how I could make it function or an easier way than what I did.
Code:
#include <stdio.h>
#include <Windows.h>
//Start of Soundboard Application
int main(void)
{
int songChoice;
printf("Welcome to Austin's Soundboard!\n");
printf("1.) Windows XP Startup Sound\n");
printf("2.) Windows XP Critical Stop Sound\n");
printf("3.) Windows XP Tada Sound\n");
printf("4.) Windows XP Notification Sound\n");
printf("5.) Windows XP Chimes Sounds\n\n");
printf("What sound effect would you like to hear? (1-5): ");
scanf_s("%d", &songChoice);
if (songChoice == 1)
PlaySound(TEXT("startup.wav"), NULL, SND_FILENAME, SND_SYNC);
if (songChoice == 2)
PlaySound(TEXT("critical.wav"), NULL, SND_FILENAME, SND_SYNC);
if (songChoice == 3)
PlaySound(TEXT("tada.wav"), NULL, SND_FILENAME, SND_SYNC);
if (songChoice == 4)
PlaySound(TEXT("notify.wav"), NULL, SND_FILENAME, SND_SYNC);
if (songChoice == 5)
PlaySound(TEXT("chimes.wav"), NULL, SND_FILENAME, SND_SYNC);
}