collapse collapse

* Who's Online

  • Dot Guests: 73
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Board Stats

  • stats Total Members: 88
  • stats Total Posts: 11163
  • stats Total Topics: 1699
  • stats Total Categories: 4
  • stats Total Boards: 76
  • stats Most Online: 248

Author Topic: C++'s Random Song.  (Read 9710 times)

0 Members and 1 Guest are viewing this topic.

Offline C++

  • Jr. Member
  • **
  • Posts: 93
  • Reputation 91
  • Gender: Male
  • C++ Programmer.
    • View Profile
C++'s Random Song.
« on: November 03, 2009, 12:46:36 pm »
Here is the source code for my random song program:

Code: C++
  1. /////////////////////////////////////////////////////////
  2. /// -- Created by C++                                 ///
  3. /// -- 03 November 2009                               ///
  4. /// -- [Random Song]                                  ///
  5. /////////////////////////////////////////////////////////
  6. #include <windows.h>
  7.  
  8. int main()
  9. {
  10.     Beep(1480,200);
  11.     Beep(1568,200);
  12.     Beep(1568,200);
  13.     Beep(1568,200);
  14.     Beep(739,99,200);
  15.     Beep(783,99,200);
  16.     Beep(783,99,200);
  17.     Beep(783,99,200);
  18.     Beep(369,99,200);
  19.     Beep(392,200);
  20.     Beep(369,99,200);
  21.     Beep(392,200);
  22.     Beep(392,400);
  23.     Beep(196,400);
  24.     Beep(739,99,200);
  25.     Beep(783,99,200);
  26.     Beep(783,99,200);
  27.     Beep(739,99,200);
  28.     Beep(783,99,200);
  29.     Beep(783,99,200);
  30.     Beep(739,99,200);
  31.     Beep(783,99,200);
  32.     Beep(880,200);
  33.     Beep(830,61,200);
  34.     Beep(880,200);
  35.     Beep(987,77,400);
  36.     Beep(880,200);
  37.     Beep(783,99,200);
  38.     Beep(698,46,200);
  39.     Beep(739,99,200);
  40.     Beep(783,99,200);
  41.     Beep(783,99,200);
  42.     Beep(739,99,200);
  43.     Beep(783,99,200);
  44.     Beep(783,99,200);
  45.     Beep(739,99,200);
  46.     Beep(783,99,200);
  47.     Beep(880,200);
  48.     Beep(830,61,200);
  49.     Beep(880,200);
  50.     Beep(987,77,400);
  51.     Sleep(200);
  52.     Beep(1108,10);
  53.     Beep(1174,7,200);
  54.     Beep(1480,10);
  55.     Beep(1568,200);
  56.     Sleep(200);
  57.     Beep(739,99,200);
  58.     Beep(783,99,200);
  59.     Beep(783,99,200);
  60.     Beep(739,99,200);
  61.     Beep(783,99,200);
  62.     Beep(783,99,200);
  63.     Beep(739,99,200);
  64.     Beep(783,99,200);
  65.     Beep(880,200);
  66.     Beep(830,61,200);
  67.     Beep(880,200);
  68.     Beep(987,77,400);
  69.     Beep(880,200);
  70.     Beep(783,99,200);
  71.     Beep(698,46,200);
  72.     Beep(659,25,200);
  73.     Beep(698,46,200);
  74.     Beep(784,200);
  75.     Beep(880,400);
  76.     Beep(784,200);
  77.     Beep(698,46,200);
  78.     Beep(659,25,200);
  79.     Beep(587,33,200);
  80.     Beep(659,25,200);
  81.     Beep(698,46,200);
  82.     Beep(784,400);
  83.     Beep(698,46,200);
  84.     Beep(659,25,200);
  85.     Beep(587,33,200);
  86.     Beep(523,25,200);
  87.     Beep(587,33,200);
  88.     Beep(659,25,200);
  89.     Beep(698,46,400);
  90.     Beep(659,25,200);
  91.     Beep(587,33,200);
  92.     Beep(493,88,200);
  93.     Beep(523,25,200);
  94.     Sleep(400);
  95.     Beep(349,23,400);
  96.     Beep(392,200);
  97.     Beep(329,63,200);
  98.     Beep(523,25,200);
  99.     Beep(493,88,200);
  100.     Beep(466,16,200);
  101.     Beep(440,200);
  102.     Beep(493,88,200);
  103.     Beep(523,25,200);
  104.     Beep(880,200);
  105.     Beep(493,88,200);
  106.     Beep(880,200);
  107.     Beep(1760,200);
  108.     Beep(440,200);
  109.     Beep(392,200);
  110.     Beep(440,200);
  111.     Beep(493,88,200);
  112.     Beep(783,99,200);
  113.     Beep(440,200);
  114.     Beep(783,99,200);
  115.     Beep(1568,200);
  116.     Beep(392,200);
  117.     Beep(349,23,200);
  118.     Beep(392,200);
  119.     Beep(440,200);
  120.     Beep(698,46,200);
  121.     Beep(415,2,200);
  122.     Beep(698,46,200);
  123.     Beep(1396,92,200);
  124.     Beep(349,23,200);
  125.     Beep(329,63,200);
  126.     Beep(311,13,200);
  127.     Beep(329,63,200);
  128.     Beep(659,25,200);
  129.     Beep(698,46,400);
  130.     Beep(783,99,400);
  131.     Beep(440,200);
  132.     Beep(493,88,200);
  133.     Beep(523,25,200);
  134.     Beep(880,200);
  135.     Beep(493,88,200);
  136.     Beep(880,200);
  137.     Beep(1760,200);
  138.     Beep(440,200);
  139.     Beep(392,200);
  140.     Beep(440,200);
  141.     Beep(493,88,200);
  142.     Beep(783,99,200);
  143.     Beep(440,200);
  144.     Beep(783,99,200);
  145.     Beep(1568,200);
  146.     Beep(392,200);
  147.     Beep(349,23,200);
  148.     Beep(392,200);
  149.     Beep(440,200);
  150.     Beep(698,46,200);
  151.     Beep(659,25,200);
  152.     Beep(698,46,200);
  153.     Beep(739,99,200);
  154.     Beep(783,99,200);
  155.     Beep(392,200);
  156.     Beep(392,200);
  157.     Beep(392,200);
  158.     Beep(392,200);
  159.     Beep(196,200);
  160.     Beep(196,200);
  161.     Beep(196,200);
  162.     Beep(185,200);
  163.     Beep(196,200);
  164.     Beep(185,200);
  165.     Beep(196,200);
  166.     Beep(207,65,200);
  167.     Beep(220,200);
  168.     Beep(233,08,200);
  169.     Beep(246,94,200);
  170. }
  171.  

And here is the program itself (Code included):

Offline Celestialkey

  • Administrator
  • Hero Member
  • *
  • Posts: 3962
  • Reputation 4874
  • Gender: Male
  • Its Alive!!
    • View Profile
    • www.CelestialCoding.com
Re: C++'s Random Song.
« Reply #1 on: November 03, 2009, 01:40:56 pm »
Since when did Beep have 3 parameters? O_O
Created By: Eczuo
Quote
I have noticed that people who claim that everything is predestined, and we can do nothing to change it, look both ways before they cross the road.
Quote
I'd prefer to die standing, than to live on my knees - Che Guevara
Quote
If you change the way you look at something, does that something change in any way?
- Quantum Theory

Hacking
Quote
Never in the field of human conflict was so much owed by so many to so few. - Winston Churchill


Quote from: Revelations 12:4
And his tail drew the third part of the stars of heaven, and did cast them into the earth; and the dragon stood before the woman which was ready to be delivered, for to devour her child as soon as it was born.

Quote
It takes skill to build an empire. It takes an idiot to maintain it.

Offline C++

  • Jr. Member
  • **
  • Posts: 93
  • Reputation 91
  • Gender: Male
  • C++ Programmer.
    • View Profile
Re: C++'s Random Song.
« Reply #2 on: November 03, 2009, 04:23:34 pm »
Since when did Beep have 3 parameters? O_O

Not sure but it works LOL

Offline Luizfe

  • - Secret Permissions Level 1 -
  • Newbie
  • *
  • Posts: 36
  • Reputation 41
  • Gender: Male
  • C++ Programmer, get@me
    • View Profile
Re: C++'s Random Song.
« Reply #3 on: November 15, 2009, 12:28:07 am »
It is, in my opinion, fudge pro.

Goals for this year:
1. Learn moderate and advanced C++.
2. Learn Direct 3D integration with C++, to develop games and hacks for them :)

Offline GodLord

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 477
  • Reputation 800
  • Gender: Male
  • C++/Java Developer
    • View Profile
Re: C++'s Random Song.
« Reply #4 on: November 28, 2009, 08:18:29 pm »
Since when did Beep have 3 parameters? O_O
Frequency, Duration, Volume

Offline Celestialkey

  • Administrator
  • Hero Member
  • *
  • Posts: 3962
  • Reputation 4874
  • Gender: Male
  • Its Alive!!
    • View Profile
    • www.CelestialCoding.com
Re: C++'s Random Song.
« Reply #5 on: November 28, 2009, 09:41:46 pm »
Mmmm, I learned something new.
Created By: Eczuo
Quote
I have noticed that people who claim that everything is predestined, and we can do nothing to change it, look both ways before they cross the road.
Quote
I'd prefer to die standing, than to live on my knees - Che Guevara
Quote
If you change the way you look at something, does that something change in any way?
- Quantum Theory

Hacking
Quote
Never in the field of human conflict was so much owed by so many to so few. - Winston Churchill


Quote from: Revelations 12:4
And his tail drew the third part of the stars of heaven, and did cast them into the earth; and the dragon stood before the woman which was ready to be delivered, for to devour her child as soon as it was born.

Quote
It takes skill to build an empire. It takes an idiot to maintain it.

Braduz

  • Guest
Re: C++'s Random Song.
« Reply #6 on: November 29, 2009, 01:45:33 pm »
Lmfao the first part is exactly like super mario XD

Offline 0xDEAD10CC

  • Newbie
  • *
  • Posts: 21
  • Reputation 0
  • Gender: Male
  • void of_space();
    • View Profile
Re: C++'s Random Song.
« Reply #7 on: April 06, 2014, 05:58:29 pm »
The Beep() function from the Windows header only has 2 parameters, there is no 3rd for volume: http://msdn.microsoft.com/en-us/library/windows/desktop/ms679277%28v=vs.85%29.aspx
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Offline Celestialkey

  • Administrator
  • Hero Member
  • *
  • Posts: 3962
  • Reputation 4874
  • Gender: Male
  • Its Alive!!
    • View Profile
    • www.CelestialCoding.com
Re: C++'s Random Song.
« Reply #8 on: April 06, 2014, 10:26:36 pm »
The Beep() function from the Windows header only has 2 parameters, there is no 3rd for volume: http://msdn.microsoft.com/en-us/library/windows/desktop/ms679277%28v=vs.85%29.aspx
I thought the same thing. But as said earlier... It works. Assuming that is the real source code, they did get it to compile for them and it does work correctly when you run the exe. Maybe a modified header or something similar?
Created By: Eczuo
Quote
I have noticed that people who claim that everything is predestined, and we can do nothing to change it, look both ways before they cross the road.
Quote
I'd prefer to die standing, than to live on my knees - Che Guevara
Quote
If you change the way you look at something, does that something change in any way?
- Quantum Theory

Hacking
Quote
Never in the field of human conflict was so much owed by so many to so few. - Winston Churchill


Quote from: Revelations 12:4
And his tail drew the third part of the stars of heaven, and did cast them into the earth; and the dragon stood before the woman which was ready to be delivered, for to devour her child as soon as it was born.

Quote
It takes skill to build an empire. It takes an idiot to maintain it.

Offline 0xDEAD10CC

  • Newbie
  • *
  • Posts: 21
  • Reputation 0
  • Gender: Male
  • void of_space();
    • View Profile
Re: C++'s Random Song.
« Reply #9 on: April 07, 2014, 12:09:13 am »
The Beep() function from the Windows header only has 2 parameters, there is no 3rd for volume: http://msdn.microsoft.com/en-us/library/windows/desktop/ms679277%28v=vs.85%29.aspx
I thought the same thing. But as said earlier... It works. Assuming that is the real source code, they did get it to compile for them and it does work correctly when you run the exe. Maybe a modified header or something similar?

That's what I would think, because it's not specified in any standards or documentation I've read.  ???
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Offline Nathan

  • Administrator
  • Hero Member
  • *
  • Posts: 1437
  • Reputation 1768
  • Gender: Male
  • woof woof
    • View Profile
Re: C++'s Random Song.
« Reply #10 on: April 07, 2014, 11:01:41 pm »
The disassembly seems to disagree with the source.
Projects:
[ Axios Engine ] [ sourcehub ]
Compilers: Microsoft Visual Studio 2008, GNU C++, FASM, MASM, VB 6/.Net.
Languages: C++, PHP, ASM, JS, VB6/.Net, BASIC, HTML, MySQL
Please buy me some books: Amazon Wishlist

Offline Celestialkey

  • Administrator
  • Hero Member
  • *
  • Posts: 3962
  • Reputation 4874
  • Gender: Male
  • Its Alive!!
    • View Profile
    • www.CelestialCoding.com
Re: C++'s Random Song.
« Reply #11 on: April 07, 2014, 11:19:10 pm »
You're right. I'm only seeing two MOVs per call. What an enigma...
Created By: Eczuo
Quote
I have noticed that people who claim that everything is predestined, and we can do nothing to change it, look both ways before they cross the road.
Quote
I'd prefer to die standing, than to live on my knees - Che Guevara
Quote
If you change the way you look at something, does that something change in any way?
- Quantum Theory

Hacking
Quote
Never in the field of human conflict was so much owed by so many to so few. - Winston Churchill


Quote from: Revelations 12:4
And his tail drew the third part of the stars of heaven, and did cast them into the earth; and the dragon stood before the woman which was ready to be delivered, for to devour her child as soon as it was born.

Quote
It takes skill to build an empire. It takes an idiot to maintain it.

 

Donate


* Search


* Recent Posts

Image Comparison by Shishka
[May 15, 2017, 01:18:02 pm]


Re: srchub - free source code hosting by Nathan
[December 14, 2015, 11:37:02 pm]


Re: srchub - free source code hosting by Celestialkey
[November 27, 2015, 08:51:42 am]


Updates by Nathan
[October 30, 2015, 08:27:36 pm]


Re: Client-Server Messaging by Nathan
[October 25, 2015, 05:48:57 pm]