作業 1 ( 匯入音源檔並播放)
Step 1 開啟貝殼(Shell)專案
Step 2 下載音源(.wav),並拉到專案資料夾中
Step 3 程式碼 :
#include <iostream>
#include <windows.h>
#include <mmsystem.h>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
PlaySoundA("Do.wav", NULL,SND_SYNC);
PlaySoundA("Re.wav", NULL,SND_SYNC);
PlaySoundA("Mi.wav", NULL,SND_SYNC);
return 0;
}
Step 4 加入Linker Setting , winmm (windows 多媒體)
Step 5 執行完成
沒有留言:
張貼留言