如何使用C编程语言创建虚拟钢琴? [英] How do I create a virtual piano using C programming language?

查看:141
本文介绍了如何使用C编程语言创建虚拟钢琴?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名工科学生。我应该用c编程语言做一个项目。我选择创建一个虚拟钢琴。但我对编码没有一个明确的想法。你能帮帮我吗?我想在键盘上添加一张钢琴的图片,并希望看到按下的应对键。我想把它作为一个应用程序。它应该是丰富多彩和有吸引力的。



我尝试了什么:



在互联网上浏览但找不到C语言的任何代码。还有哪些线索哪条我在其他语言中遇到了很多错误。我与朋友讨论过,但不幸的是他们在这个问题上无能为力。

I am an Engineering student.I ought to do a project using c programming language.I have chosen to create a virtual piano . But I do not have a clear idea about coding.Can you please help me out? I would like to add a picture of piano on the keyboard and want to see the corressponding keys being pressed .I want to do it as an app.It should be colourful and attractive.

What I have tried:

Surfed in the Internet but could not find any code in C language.Also the cords which I got in other languages are full of errors.I discussed with my friends but unfortunately they are helpless in this concern.

推荐答案

即使不知道你的实际目标 OS ,我想 C 编程语言它不是你描绘的工作的最佳选择(例如, Windows ,编写一个完整的,有吸引力的 GUI ,对于 C )。

我建议你改变开发编程语言(在 Window s,我会考虑 C# )或项目。
Even without knowing your actual target OS, I guess the C programming language it is not the best choice for the job you depicted (for instance, on Windows, writing a full-fledged, attractive GUI, would be clumsy with C).
I suggest you to either change the development programming language (on Windows, I would consider C#) or the project.


你找不到任何代码完全符合你的要求:即使你可以,这也是抄袭,而不是做一个项目 - 大多数导师都是明智的!



我们不做你的作业:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



如果您遇到特定问题,请询问关于这一点,我们将尽力提供帮助。但是我们不会为你做这一切!



但是......你听起来并不像在这里有很多开发经验,这不是'一个完整的初学者的工作:你将不得不学习用C语言编写图形环境(为了绘制图片),在C中可能意味着学习如何在Windows中编码 - 这显然是非平凡的!

如果可以,找一个更简单的项目,或者更改语言:C#将更容易实现这一点,因为初始学习曲线比用C语言编写的要少得多砖墙 Windows。
You won't find any code that fits exactly what you want: and even if you could, that would be plagiarism, not "doing a project" - and most tutors are wise to that!.

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!

But ... You don't sound like you have much development experience here, and this isn't a job for a complete beginner: you are going to have to learn to code in C for a graphics environment (in order to draw the pictures) which in C probably means learning how to code in Windows - which is decidedly non-trivial!
If you can, find a simpler project, or change languages: C# would be a load easier to do this in as the initial learning curve is a lot less "brick wall" like than coding in C for Windows.


所以,如果你真的想做一个经验丰富的程序员的工作,你需要学习编程。这需要几周的深入学习才能获得基本技能。您还应该考虑更高级别的语言,如C#或Java - 取决于您的目标平台。



为了在屏幕上显示某些内容,通常使用位图是最好的,最简单的方法。在你的应用程序中:一个非按下的按键位图,当按下而不是用按下的按键位图交换。像墙上的砖一样,你会显示这些元素的数组。



当我使用Google搜索时,我在几秒钟内就找到了这个简单但很好的键盘示例。只需要在按钮上设置合适的位图)羞耻...
So if you really want to do the work of a seasoned programmer you need to learn programming. This needs some weeks of intensive learning to acquire the basic skills. You also should consider a higher level language like C# or Java - depending on your target platfrom.

For showing something on the screen normally is the use of bitmaps the best and easiest way. In your app: a "non pressed key bitmap, and when pressed than exchanged with a "pressed key" bitmap. Like bricks in a wall you show an array of these elements.

When I search with Google I had found this simple but good keyboard example in some seconds. (You only need to set suitable bitmaps on the buttons) Shame on you...


这篇关于如何使用C编程语言创建虚拟钢琴?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆