Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- using namespace std;
- void sounds(string music);
- string Convert_upper(string word);
- int main()
- {
- string music;
- cout << "Input string for playing" << endl;
- getline(cin, music);
- string upper = Convert_upper(music);
- sounds(upper);
- }
- string Convert_upper(string word)
- {
- string final;
- for (int i = 0;i<word.size();i++)
- {
- final += toupper(word[i]);
- }
- return final;
- }
- void sounds(string music)
- {
- for (int i = 0;i<music.size();i++)
- {
- switch(music[i])
- {
- case 'A' : Beep(220,200);
- case 'B' : Beep(250,200);
- case 'C' : Beep(260,200);
- case 'D' : Beep(300,200);
- case 'E' : Beep(330,200);
- case 'F' : Beep(350,200);
- case 'G' : Beep(400,200);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment