惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - 雪无止境

WEB 架构布置 YouTube的系统架构 [原创]如何得到网站的最后更新日期 首例全国性电子商务规范将出台 Ajax 及 JavaScript 在各浏览器下的兼容性问题 安装Microsoft VS2003“安装程序检测到另一个程序要求计算机重新启动 ASP.Net 注册组件 如何用正确的方法来写出质量好的软件的75条体会 ASP.NET 生成图形验证码 (C#版本) [原创]在ASP.NET中为图形加水印的方法 (C#版本) IE 与 FireFox 的 showModalDialog 用户 'sa' 登录失败。原因: 未与信任 SQL Server 连接相关联 常用SQL ASP获取即时ID值(自动编号) ASP ADOX 使用范例 [原创]重载、继承 [原创]ASP开发工具论 [原创]用Data Shape 来取关系数据库的多表记录 [原创]基于角色的Roles
[原创]让C#驱动机器,为我们奏响电子音乐
雪无止境 · 2006-09-30 · via 博客园 - 雪无止境

创建一个控制台应用程序
引用 System.Runtime.InteropServices 和 System类库

    class MachineMusic
    
{
        
/// <summary>
        
/// 应用程序的主入口点。
        
/// </summary>


        [DllImport(
"kernel32.dll")]
        
public static extern bool Beep(int frequency,int duration);

        [STAThread]
        
static void Main(string[] args)
        
{
            Music();
        }


        
private static void Music()
        
{
            Random random
=new Random();
            
for(int i =0;i<10;i++)
            
{
                Beep(random.Next(
10000),100);
            }


            Console.WriteLine(
"Play again? Press y to again");
            
string key=Console.ReadLine();
            
if (key=="y")
            
{
                Music();
            }

        }

    }