Hi!大家好!我是你们的编程小王子

最近一直拖着没更新,因为实在是没什么游戏思路。但是终于搞出来一个

金山打字通相信很多小伙伴们都认识,所以东西我就不多介绍,今天主要讲解音乐的播放(超级简单的)!

//这里提醒大家一下,这一个音乐播放函数,只限于.wav文件
//是因为C++最基础的音乐只支持Windows自带的wav格式播放
//有需要的话可以下载一个音乐格式转换器,吧mp3转换一下DWORD WINAPI FunctionName(LPVOID lpParamte) {DWORD OBJ;sndPlaySound(TEXT("MusicName.wav"), SND_FILENAME|SND_ASYNC);return 0;
}

然后还要一个调用的公式

HANDLE MFUN;
MFUN= CreateThread(NULL, 0, FunctionName, NULL, 0, NULL);

这样就能播放音乐啦

这个我相信大家都理解了,接下来上代码

#include<bits/stdc++.h>
#include<windows.h>
#include<unistd.h>
#include<conio.h>
using namespace std;
unsigned long long wrong;
DWORD WINAPI Type(LPVOID lpParamte) {DWORD OBJ;sndPlaySound(TEXT("Type.wav"), SND_FILENAME|SND_ASYNC);return 0;
}
DWORD WINAPI Error(LPVOID lpParamte) {DWORD OBJ;sndPlaySound(TEXT("error.wav"), SND_FILENAME|SND_ASYNC);return 0;
}
void SetPos(int x,int y) {HANDLE Handle;COORD pos= {y,x};Handle=GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleCursorPosition(Handle,pos);
}
void HideCursor() {CONSOLE_CURSOR_INFO cursor_info= {1,0};SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
}
void arti(string article) {system("cls");SetPos(15,105);cout<<"结束后输入Enter"<<endl;SetPos(0,0);article+="\n";cout<<article<<endl;HANDLE MFUN;for(int i=0; i<article.size(); i++) {char g=getch();HideCursor();if(i==article.size()-1) break;while(g!=article[i]) {if(i==article.size()-1) break;MFUN= CreateThread(NULL, 0, Error, NULL, 0, NULL);++wrong;g=getch();}MFUN= CreateThread(NULL, 0, Type, NULL, 0, NULL);cout<<g;if(i==article.size()-1) break;}system("cls");cout<<endl<<endl;cout<<"Wrong times: "<<wrong<<endl;cout<<"congratulations!You finished another article!"<<endl;
}
int main() {char select;cout<<"                                   金       山      打       字       通                                "<<endl;cout<<"                                                英文  模式                                              "<<endl;cout<<"                                             1. The cat and mice                                        "<<endl;cout<<"                                          2.make the finishing point                                    "<<endl;cout<<"                                               3. help others                                           "<<endl;cout<<"                                           4. find your own skills                                      "<<endl;cout<<"                                           5. The fox and the cock                                      "<<endl;cout<<"                                                6. 切换模式                                             "<<endl;select=getch();if(select=='1') {arti("Long ago, there was a big cat in the house. He caught many mice while they were stealing food.One day the mice had a meeting to talk about the way to deal with their common enemy. Some said this, and some said that. At last a young mouse got up, and said that he had a good idea.'We could tie a bell around the neck of the cat. Then when he comes near, we can hear the sound of the bell, and run away.'Everyone approved of this proposal, but an old wise mouse got up and said, 'That is all very well, but who will tie the bell to the cat?' The mice looked at each other, but nobody spoke.");return 0;} else if(select=='2') {arti("Mr. Li is a good painter. One day he draws a beautiful dragon without eyes.Mr. Zhou looks at the picture and says, 'The dragon has no eyes. It isn't a good picture.'But Mr. Li smiles and says, 'If I add eyes to the dragon, it will fly away.'Mr. Zhou shakes his head and says, 'You are boasting. I don't believe you.'Mr. Li isn't angry. He holds the paintbrush and adds eyes to the dragon. Wow! The dragon really flies.");return 0;} else if(select=='3') {arti("One day, a poor man is taking a bag of rice to a town. The rice is on the back of his horse but it falls down. The rice is too heavy to lift and he doesn’t know what to do. He only hopes someone can give him some help.After a while, a man riding a horse comes. But he is a rich man living nearby. The poor man hopes another farmer will come. But the rich man sees him and says to him, 'You need my help, right?' And he helps the poor man lift the rice onto the horse’s back.'Sir, how can I repay you?' the poor man says.'It’s easy, when you see anyone else in trouble, do the same for him.'");return 0;} else if(select=='4') {arti("On the third day after he was born, Little Elephant went with his mother to the banks of a stream, and there he saw a bird in the sky flying here and there. Little Elephant said: 'If I could fly, I could see even more things, it would be great!'In order to learn to fly, Little Elephant climbed a tree and, with a yelp of 'Ouch!'. fell heavily to the ground.Seeing this, the snake said: 'Little elephant, we all have our own abilities. I can't fly, but I can sleep in a tree.'Lion said: 'I also can't fly, but I can jump across a wide river.'Tiger said, 'I can't fly, but I can swim!'Little Elephant's father and mother said to him, 'We elephants have great strength, incomparably greater than little birds.'Little Elephant understood. He used his long nose as a hook and moved a large branch.");return 0;} else if(select=='5') {arti("One morning a fox sees a cock.He thinks,This is my breakfast.He comes up to the cock and says, 'know you can sing very well.Can you sing for me?'The cock is glad.He closes his eyes and begins to sing.'he fox sees that and caches him in his mouth and carries him away. The people in the field see the fox.They cry,'Look,look!The fox is carrying the cock away.'The cock says to the fox,'Mr Fox,do you understand?The people say you are carrying their cock away.Tell them it is yours.Not theirs.' The fox opens his mouth ang says,'The cock is mine,not yours.'Just then the cock runs away from the fox and flies into the tree.");return 0;} else if(select=='6') {system("cls");cout<<"                                   金       山      打       字       通                                "<<endl;cout<<"                                                中文  模式                                              "<<endl;cout<<"                                               1. 故事与星星                                            "<<endl;cout<<"                                               2. 快乐的秋天                                            "<<endl;cout<<"                                                3. 下雪啦                                               "<<endl;cout<<"                                                4. 登华山                                               "<<endl;select=getch();if(select=='1') {arti("故事就像天上的星星,数也数不清。故事有长有短;星星有大有小。故事有平淡的,精彩的,更精彩的;星星有暗的,亮的,更亮的,故事是永恒的,星星也是永恒的。星星印在孩子的眼里,故事留在孩子心里。星星会滑落吗?不,它永远挂在天空;故事会消失吗?不,它永远留在人心中。即使夜色多浓,星星依然保持着内心的明亮。即使世界更精彩,故事依然照亮孩子的心灵。");return 0;} else if(select=='2') {arti("秋天,如果你来到森林公园,你就能看到一片片落叶,如果你有机会来到田野,就能看到一片丰收的景象,小伙伴们!让我们行动起来吧,去寻找秋天的快乐。来到公园,小伙伴们有的在摘果实,有的在收集各种各样的树叶,落叶像一封封邮件,寄啊寄啊,寄走了夏天的告别,秋天的到来。小喜鹊叼来了树枝造房子,小青蛙在加紧挖洞,准备过冬,小松鼠找来松果当粮食,松柏穿上了厚厚的衣服。来到田野,是一个丰收的景象,高粱像一个个喝醉的大汉,稻谷就像害羞的小姑娘。秋天,是一个丰收的季节,我喜欢秋天。");return 0;} else if(select=='3') {arti("清晨,我来到窗前,透过玻璃向外望去,展此刻眼前的是一个银色的世界,啊!下雪啦!雪花落在了玻璃上融化了的图案,有的像一朵朵小花,有的像高高的宝塔,有的像栩栩如生的小雪人。我迫不及待地地跑下楼,投入了雪花的怀抱,哇!多美妙的雪的世界呀!雪花落在了楼顶上,像是给房屋换上了一件漂亮的新衣;雪花落在了小树上,像是给小树穿上了圣洁美丽的裙纱;雪花落在了小路上,像是给小路铺上了一层柔软而洁白的地毯。小朋友们也来到了户外,在雪地上快乐地游戏着,有的在滚雪球,有的在打雪仗,有的在推雪人,我最喜爱大家堆朔的小白兔,长长的耳朵,红红的眼睛,胖乎乎的可爱极了,在这雪的家园小朋友们玩的真快乐啊!我爱这洁白的雪花,我爱这雪花的世界!");return 0;} else if(select=='4') {arti("五岳的西岳--华山,是我爬过最高的山,海拔约2160米。那里山势险峻,四周都是悬崖峭壁,一棵树也没有,百鸟不息。在山上,太阳好像离你很近,白云好像很低,果然是只有天在上,更无山与齐。举头红日近,回首白去低。一路上,华山的奇峰、怪石、云海、鸣泉、飞瀑、古迹遍布,三面临空的鹞子翻身,以及在峭壁绝崖上凿出的千尺幢、老君梨沟、上天梯、苍龙岭等到都是上山的绝险要路,几乎让我放下征服这些险上加险的险境。但是,随着一颗不想放下的心飞上了山顶,我最后还是战胜了难关,登上山顶。感受奇峰峭壁、险径危石的险,品味鬼斧神工的美,华山游多么令我难忘。");return 0;}} else if(select=='7') {arti("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");return 0;} else if(select=='8') {arti("123");return 0;}return 0;
}

这个文章是我网上收集的,大家也可以自己多去收集一下

大佬们可以尝试把英文模式和中文模式做成可以随意切换的那种

这些音乐的链接如下

第一个:Dev-C++游戏创作之金山打字通-其他文档类资源-CSDN下载

第二个:Dev-C++游戏创作之金山打字通-其他文档类资源-CSDN下载

OK!我会尽快更新的,希望大家能支持我一下

你们懂的,点个赞呗,拜拜ヾ( ̄▽ ̄)Bye~Bye~

Dev-C++游戏创作之金山打字通(附带音乐)相关推荐

  1. C语言编一个金山打字通小游戏,js实现金山打字通小游戏

    本文实例为大家分享了js实现金山打字通小游戏的具体代码,供大家参考,具体内容如下 字母匀速随机下落,键盘按下对应字母按键,字母消失重新生成新字母,新字母可帮助回调一部分初始高度 效果 1.页面内容 列 ...

  2. java打字游戏_Java仿金山打字通打字母游戏《Java就该这样学》

    前面我写过关于键盘控制小球,以及模仿下雪的代码.此次算是对前一段时间知识的汇总.依旧很肤浅的没有面向对象的概念.还是俩个class. MyChar 为主测试类,MyPanel为功能类.MyPanel已 ...

  3. 金山打字通2008完整版包含金山打字游戏,网上唯一的

    金山打字通2008 官方正式完整版,网上唯一的,其他都是不完整的.2007,2009版为虚假,官方未出此版. [概括介绍] 金山打字通是一款学习打字软件具有英文打字.拼音打字.五笔打字.打字游戏等功能 ...

  4. 金山打字通生死时速游戏介绍

    金山打字通是一款帮助用户从零开始学习打字的软件,其内置的游戏使打字这一枯燥的活动变得更加有趣.在内置的五款游戏中,属生死时速(又名警察抓小偷)的制作最为精良,可玩性也最高. 设计元素 玩家 角色与特征 ...

  5. 官方金山打字通2009

    官方金山打字通2009 软件类别:国产软件/教育教学 运行环境: Win98/2000/XP/2003/Vista 软件语言:简体中文 开发作者: 金山软件公司 官方网站:http://www.syy ...

  6. 金山打字通2008下载-金山打字通2008正式版-金山打字通2008完整版

    金山打字通2008下载:金山打字通2008正式版集成金山打字通2008以及金山打字游戏2008两个版本于一身.主要由英文打字.拼音打字.五笔打字.打字游戏等六部分组成.所有练习用词汇和文章都分专业和通 ...

  7. 2019数据安装勾选_金山打字通 2016 软件安装教程

    [软件名称]:金山打字通 2016 [安装环境]:Windows [下载链接]: [下载链接]:https://www.sssam.com/7680.html 软件简介 金山打字通是一款功能齐全.数据 ...

  8. 解决金山打字通不能缩小窗口问题

    前段时间,在学五笔, 用的是金山打字通, 但是金山打字通只能全屏显示,这个本没有什么的, 但是我又想在练习的同时看电影,所以这样缩小窗口就显得很重要了 在网上搜索了一下发现金山打字通本身就不能全屏. ...

  9. 小白练打字:金山打字通

    对于小白来说,首先肯定练打字,那么打字软件就很必要了,比如金山打字通 打开界面是这样 如果是完全小白,先用新手入门熟悉键盘 稍有基础则选英文打字进一步熟悉 最后当然练中文 除此之外还有打字 这就是打字 ...

最新文章

  1. 目标跟踪之粒子滤波---Opencv实现粒子滤波算法
  2. vuedraggable示例_vue拖拽列表vuedraggable
  3. 机器人专用符文_英雄联盟【LOL】手游部分英雄天赋符文和出装推荐
  4. Android特效专辑(十二)——仿支付宝咻一咻功能实现波纹扩散特效,精细小巧的View...
  5. 在android中监听呼出电话(电话拦截、修改呼出电话)
  6. 如何使用 ABAP 把多个文件打成一个 zip包 -利用 ABAP 标准工具类 cl_abap_zip
  7. android studio导入eclipse项目各种问题,Android | 导入Eclipse项目到Android studio的问题解决全过程...
  8. python 漂亮界面demo_在这个什么都看脸的时代,如何用 GUI 提高 python 程序的颜值?...
  9. c语言题目1120,九度题目1120:全排列
  10. CSDN 蒋涛对话英特尔中国区董事长王锐:我愿是当代的一个开发者
  11. “拯救网站运维经理赵明”已近尾声
  12. vscode 历史版本1.68.1
  13. 太阳当空照-Windows服务化方式NSSM指令清单
  14. 如何注册海外邮箱?如何进行邮箱注册163,这些技巧交给你
  15. VS code + Java 配置与使用
  16. 【CV算法兵器】“晓风残月” ->对抗攻击“兵器”大放送(综述篇)
  17. 存储卡的相关标准.CF.SD.SDHC.MMC.TF
  18. sqlalchemy.exc.ProgrammingError: (pymysql.err.ProgrammingError) (1064, “You have an error in your SQ
  19. 酷派手机(Coolpad 8297-T01)在Android开发工具如AndroidStudio、Eclipse中无法打印Log
  20. MFC中CreateCompatibleDC的作用

热门文章

  1. amd显卡用黑苹果输出黑屏_黑苹果用杂交法修改framebuffer开启显卡所有输出端口成功...
  2. [007]爬虫系列 | 猿人学爬虫攻防大赛 | 第五题: js混淆 乱码增强(中)
  3. iOS 使用lame录音文件wav转mp3
  4. 电脑突然无法上网如何解决 如何重新启用以太网
  5. 6个高清图片下载网站:免费!可商用!帮助各位CSDN产品、UI、前端、运营、数据分析、图形图像处理与AI学习等伙伴们!
  6. 数商云:竞争优势的来源 ——全渠道物流服务生态系统
  7. 一张工程师的能力图的评述
  8. linux怎么启动.sh文件,Linux下面如何运行.sh文件
  9. EDI的含义,作用方式以及主要优势
  10. python 正数变成负数_入门 | 32个常用 Python 实现