This is the function I made:
void loading(bool wsound) {
if (wsound = true)
{
PlaySound(TEXT("sounds/intro.wav"), NULL, SND_ASYNC);
cout << "..........";
Sleep(1000);
cout << "..........";
Sleep(1000);
cout << "..........";
Sleep(1000);
cout << "..........";
Sleep(1000);
cout << "..........";
Sleep(1000);
cout << ".........." << endl;
Sleep(1000);
}
else if (wsound = false)
{
cout << "..........";
Sleep(1000);
cout << "..........";
Sleep(1000);
cout << ".........." << endl;
}
else {
cout << "An error occured" << endl;
cin.get();
system("exit");
}
}
So what this basically does is that it takes a bool if the value is true then it loads it with sounds if false then it loads it without sounds.
My problem is that in the main I placed a bool with the value of true then it worked though after calling it again with the value type of false it still loads it with sounds.
The code is like this:
//a bunch of code here
loading(true);
//a bunch of code here
loading(false);
//and more codes.........